Commit 51b9e5d6ebe9
Changed files (8)
modules
profiles
modules/profiles/avahi.nix
@@ -0,0 +1,31 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+ cfg = config.profiles.avahi;
+in
+{
+ options = {
+ profiles.avahi = {
+ enable = mkOption {
+ default = false;
+ description = "Enable avahi profile";
+ type = types.bool;
+ };
+ };
+ };
+ config = mkIf cfg.enable {
+ services = {
+ avahi = {
+ enable = true;
+ ipv4 = true;
+ ipv6 = true;
+ nssmdns = true;
+ publish = {
+ enable = true;
+ userServices = true;
+ };
+ };
+ };
+ };
+}
modules/profiles/desktop.nix
@@ -12,14 +12,161 @@ in
description = "Enable desktop profile";
type = types.bool;
};
+ avahi = mkOption {
+ default = true;
+ description = "Enable avahi with the desktop profile";
+ type = types.bool;
+ };
pulseaudio = mkOption {
default = true;
description = "Enable pulseaudio with the desktop profile";
type = types.bool;
};
+ flatpak = mkOption {
+ default = true;
+ description = "Enable flatpak with the desktop profile";
+ type = types.bool;
+ };
+ syncthing = mkOption {
+ default = true;
+ description = "Enable syncthing with the desktop profile";
+ type = types.bool;
+ };
};
};
config = mkIf cfg.enable {
profiles.pulseaudio.enable = cfg.pulseaudio;
+ profiles.avahi.enable = cfg.avahi;
+ profiles.syncthing.enable = cfg.syncthing;
+
+ boot = {
+ tmpOnTmpfs = true;
+ plymouth.enable = true;
+ };
+
+ networking.networkmanager = {
+ enable = true;
+ unmanaged = [
+ "interface-name:ve-*" "interface-name:veth*" "interface-name:wg0"
+ ];
+ packages = with pkgs; [ networkmanager-openvpn ];
+ };
+ services = {
+ flatpak.enable = cfg.flatpak;
+ xserver = {
+ enable = true;
+ enableTCP = false;
+ windowManager.twm.enable = true;
+ libinput.enable = true;
+ synaptics.enable = false;
+ layout = "fr(bepo),fr";
+ xkbVariant = "oss";
+ xkbOptions = "grp:menu_toggle,grp_led:caps,compose:caps";
+ inputClassSections = [
+ ''
+ Identifier "TypeMatrix"
+ MatchIsKeyboard "on"
+ MatchVendor "TypeMatrix.com"
+ MatchProduct "USB Keyboard"
+ Driver "evdev"
+ Option "XbkModel" "tm2030USB"
+ Option "XkbLayout" "fr"
+ Option "XkbVariant" "bepo"
+ ''
+ ''
+ Identifier "ErgoDox"
+ MatchIsKeyboard "on"
+ #MatchVendor "ErgoDox_EZ"
+ #MatchProduct "ErgoDox_EZ"
+ MatchUSBID "feed:1307"
+ Driver "evdev"
+ Option "XkbLayout" "fr"
+ Option "XkbVariant" "bepo"
+ ''
+ ];
+ displayManager = {
+ slim = {
+ enable = true;
+ # Probably put this into users instead ?
+ defaultUser = "vincent";
+ };
+ };
+ };
+ };
+
+ fonts = {
+ enableFontDir = true;
+ enableGhostscriptFonts = true;
+ fonts = with pkgs; [
+ corefonts
+ dejavu_fonts
+ emojione
+ feh
+ fira
+ fira-code
+ fira-code-symbols
+ fira-mono
+ font-droid
+ hasklig
+ inconsolata
+ iosevka
+ overpass
+ symbola
+ source-code-pro
+ ubuntu_font_family
+ unifont
+ ];
+ };
+
+
+ # Polkit.
+ security.polkit.extraConfig = ''
+ polkit.addRule(function(action, subject) {
+ if ((action.id == "org.freedesktop.udisks2.filesystem-mount-system" ||
+ action.id == "org.freedesktop.udisks2.encrypted-unlock-system"
+ ) &&
+ subject.local && subject.active && subject.isInGroup("users")) {
+ return polkit.Result.YES;
+ }
+ var YES = polkit.Result.YES;
+ var permission = {
+ // required for udisks1:
+ "org.freedesktop.udisks.filesystem-mount": YES,
+ "org.freedesktop.udisks.luks-unlock": YES,
+ "org.freedesktop.udisks.drive-eject": YES,
+ "org.freedesktop.udisks.drive-detach": YES,
+ // required for udisks2:
+ "org.freedesktop.udisks2.filesystem-mount": YES,
+ "org.freedesktop.udisks2.encrypted-unlock": YES,
+ "org.freedesktop.udisks2.eject-media": YES,
+ "org.freedesktop.udisks2.power-off-drive": YES,
+ // required for udisks2 if using udiskie from another seat (e.g. systemd):
+ "org.freedesktop.udisks2.filesystem-mount-other-seat": YES,
+ "org.freedesktop.udisks2.filesystem-unmount-others": YES,
+ "org.freedesktop.udisks2.encrypted-unlock-other-seat": YES,
+ "org.freedesktop.udisks2.eject-media-other-seat": YES,
+ "org.freedesktop.udisks2.power-off-drive-other-seat": YES
+ };
+ if (subject.isInGroup("wheel")) {
+ return permission[action.id];
+ }
+ });
+ '';
+
+ environment.systemPackages = with pkgs; [
+ cryptsetup
+ xlibs.xmodmap
+ xorg.xbacklight
+ xorg.xdpyinfo
+ xorg.xhost
+ xorg.xinit
+ xss-lock
+ xorg.xmessage
+ unzip
+ gnupg
+ pinentry
+ # user repositories
+ nur.repos.mic92.inxi
+ ];
};
}
modules/profiles/nix-auto-update.nix
@@ -28,6 +28,25 @@ in
system = {
stateVersion = cfg.version;
};
+ # Auto refresh nix-channel each day
+ systemd.user.services.channel-update = {
+ description = "Update nix-channel daily";
+ wantedBy = [ "multi-user.target" ];
+ serviceConfig = {
+ Type = "oneshot";
+ ExecStart = "/run/current-system/sw/bin/nix-channel --update";
+ Environment = "PATH=/run/current-system/sw/bin";
+ };
+ };
+ systemd.user.timers.channel-update = {
+ description = "Update nix-channel daily";
+ wantedBy = [ "timers.target" ];
+ timerConfig = {
+ OnCalendar = "daily";
+ Persistent = "true";
+ };
+ };
+ systemd.user.timers.channel-update.enable = true;
systemd.services.nixos-update = {
description = "NixOS Upgrade";
unitConfig.X-StopOnRemoval = false;
modules/profiles/syncthing.nix
@@ -0,0 +1,25 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+ cfg = config.profiles.syncthing;
+in
+{
+ options = {
+ profiles.syncthing = {
+ enable = mkOption {
+ default = false;
+ description = "Enable syncthing profile";
+ type = types.bool;
+ };
+ };
+ };
+ config = mkIf cfg.enable {
+ services.syncthing-edge = {
+ enable = true;
+ user = "vincent";
+ dataDir = "/home/vincent/.syncthing";
+ openDefaultPorts = true;
+ };
+ };
+}
modules/module-list.nix
@@ -2,6 +2,7 @@
{
imports = [
+ ./profiles/avahi.nix
./profiles/buildkit.nix
./profiles/fish.nix
./profiles/containerd.nix
@@ -12,6 +13,7 @@
./profiles/nix-config.nix
./profiles/nix-auto-update.nix
./profiles/pulseaudio.nix
+ ./profiles/syncthing.nix
./profiles/users.nix
./profiles/virtualization.nix
./programs/podman.nix
profiles/avahi.nix
@@ -1,16 +0,0 @@
-{ configs, pkgs, ... }:
-
-{
- services = {
- avahi = {
- enable = true;
- ipv4 = true;
- ipv6 = true;
- nssmdns = true;
- publish = {
- enable = true;
- userServices = true;
- };
- };
- };
-}
profiles/desktop.nix
@@ -4,157 +4,9 @@
imports = [
./printing.nix
./scanning.nix
- ./avahi.nix
- ./syncthing.nix
];
boot.loader.efi.canTouchEfiVariables = true;
- boot.tmpOnTmpfs = true;
- boot.plymouth.enable = true;
-
- environment.systemPackages = with pkgs; [
- cryptsetup
- emacs
- xlibs.xmodmap
- xorg.xbacklight
- xorg.xdpyinfo
- xorg.xhost
- xorg.xinit
- xss-lock
- xorg.xmessage
- unzip
- gnupg
- pinentry
- mpv
- # user repositories
- nur.repos.mic92.inxi
- ];
hardware.opengl.extraPackages = [ pkgs.vaapiIntel ];
- networking.networkmanager = {
- enable = true;
- unmanaged = [
- "interface-name:ve-*" "interface-name:veth*"
- ];
- packages = with pkgs; [ networkmanager-openvpn ];
- };
- services = {
- flatpak.enable = true;
- xserver = {
- enable = true;
- enableTCP = false;
- windowManager.twm.enable = true;
- libinput.enable = true;
- synaptics.enable = false;
- layout = "fr(bepo),fr";
- xkbVariant = "oss";
- xkbOptions = "grp:menu_toggle,grp_led:caps,compose:caps";
- inputClassSections = [
- ''
- Identifier "TypeMatrix"
- MatchIsKeyboard "on"
- MatchVendor "TypeMatrix.com"
- MatchProduct "USB Keyboard"
- Driver "evdev"
- Option "XbkModel" "tm2030USB"
- Option "XkbLayout" "fr"
- Option "XkbVariant" "bepo"
- ''
- ''
- Identifier "ErgoDox"
- MatchIsKeyboard "on"
- #MatchVendor "ErgoDox_EZ"
- #MatchProduct "ErgoDox_EZ"
- MatchUSBID "feed:1307"
- Driver "evdev"
- Option "XkbLayout" "fr"
- Option "XkbVariant" "bepo"
- ''
- ];
- displayManager = {
- slim = {
- enable = true;
- # Probably put this into users instead ?
- defaultUser = "vincent";
- };
- };
- };
- };
-
- fonts = {
- enableFontDir = true;
- enableGhostscriptFonts = true;
- fonts = with pkgs; [
- corefonts
- dejavu_fonts
- emojione
- feh
- fira
- fira-code
- fira-code-symbols
- fira-mono
- font-droid
- hasklig
- inconsolata
- iosevka
- overpass
- symbola
- source-code-pro
- ubuntu_font_family
- unifont
- ];
- };
-
-
- # Polkit.
- security.polkit.extraConfig = ''
- polkit.addRule(function(action, subject) {
- if ((action.id == "org.freedesktop.udisks2.filesystem-mount-system" ||
- action.id == "org.freedesktop.udisks2.encrypted-unlock-system"
- ) &&
- subject.local && subject.active && subject.isInGroup("users")) {
- return polkit.Result.YES;
- }
- var YES = polkit.Result.YES;
- var permission = {
- // required for udisks1:
- "org.freedesktop.udisks.filesystem-mount": YES,
- "org.freedesktop.udisks.luks-unlock": YES,
- "org.freedesktop.udisks.drive-eject": YES,
- "org.freedesktop.udisks.drive-detach": YES,
- // required for udisks2:
- "org.freedesktop.udisks2.filesystem-mount": YES,
- "org.freedesktop.udisks2.encrypted-unlock": YES,
- "org.freedesktop.udisks2.eject-media": YES,
- "org.freedesktop.udisks2.power-off-drive": YES,
- // required for udisks2 if using udiskie from another seat (e.g. systemd):
- "org.freedesktop.udisks2.filesystem-mount-other-seat": YES,
- "org.freedesktop.udisks2.filesystem-unmount-others": YES,
- "org.freedesktop.udisks2.encrypted-unlock-other-seat": YES,
- "org.freedesktop.udisks2.eject-media-other-seat": YES,
- "org.freedesktop.udisks2.power-off-drive-other-seat": YES
- };
- if (subject.isInGroup("wheel")) {
- return permission[action.id];
- }
- });
- '';
- # Auto refresh nix-channel each day
- systemd.user.services.channel-update = {
- description = "Update nix-channel daily";
- wantedBy = [ "multi-user.target" ];
- serviceConfig = {
- Type = "oneshot";
- ExecStart = "/run/current-system/sw/bin/nix-channel --update";
- Environment = "PATH=/run/current-system/sw/bin";
- };
- };
- systemd.user.timers.channel-update = {
- description = "Update nix-channel daily";
- wantedBy = [ "timers.target" ];
- timerConfig = {
- OnCalendar = "daily";
- Persistent = "true";
- };
- };
- systemd.user.timers.channel-update.enable = true;
+
}
profiles/syncthing.nix
@@ -1,10 +0,0 @@
-{ config, pkgs, ... }:
-
-{
- services.syncthing-edge = {
- enable = true;
- user = "vincent";
- dataDir = "/home/vincent/.syncthing";
- openDefaultPorts = true;
- };
-}