From 9dfe8aa9f24d9409c24bdf151c2cbce40e1f4c69 Mon Sep 17 00:00:00 2001 From: Julian Mutter Date: Wed, 9 Oct 2024 15:22:18 +0200 Subject: [PATCH] Move common aspi and kardorf nixos-config to modules --- modules/nixos/boot-efi/default.nix | 10 + modules/nixos/builder/default.nix | 55 +++++ modules/nixos/keymap/default.nix | 42 ++++ modules/nixos/keyring/default.nix | 35 ++++ modules/nixos/nix-settings/default.nix | 59 ++++++ modules/nixos/polkit/default.nix | 51 +++++ modules/nixos/sound/default.nix | 54 +++++ modules/nixos/syncthing/default.nix | 65 ++++++ modules/nixos/users-julian/default.nix | 49 +++++ modules/nixos/virtualbox/default.nix | 38 ++++ modules/nixos/xdg-portal/default.nix | 37 ++++ modules/nixos/xserver-defaults/default.nix | 43 ++++ systems/x86_64-linux/aspi/default.nix | 221 ++------------------- systems/x86_64-linux/kardorf/default.nix | 213 +++----------------- 14 files changed, 581 insertions(+), 391 deletions(-) create mode 100644 modules/nixos/builder/default.nix create mode 100644 modules/nixos/keymap/default.nix create mode 100644 modules/nixos/keyring/default.nix create mode 100644 modules/nixos/nix-settings/default.nix create mode 100644 modules/nixos/polkit/default.nix create mode 100644 modules/nixos/sound/default.nix create mode 100644 modules/nixos/syncthing/default.nix create mode 100644 modules/nixos/users-julian/default.nix create mode 100644 modules/nixos/virtualbox/default.nix create mode 100644 modules/nixos/xdg-portal/default.nix create mode 100644 modules/nixos/xserver-defaults/default.nix diff --git a/modules/nixos/boot-efi/default.nix b/modules/nixos/boot-efi/default.nix index cbbf940..9fdb876 100644 --- a/modules/nixos/boot-efi/default.nix +++ b/modules/nixos/boot-efi/default.nix @@ -15,11 +15,21 @@ in }; config = mkIf cfg.enable { + # Bootloader + # Use this for simple nix boot menu, if no dual boot required boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.configurationLimit = 10; boot.loader.efi.canTouchEfiVariables = true; # https://github.com/NixOS/nixpkgs/blob/c32c39d6f3b1fe6514598fa40ad2cf9ce22c3fb7/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix#L66 boot.loader.systemd-boot.editor = false; + + boot.supportedFilesystems = [ + "btrfs" + "ntfs" + "nfs" + "cifs" + ]; + }; } diff --git a/modules/nixos/builder/default.nix b/modules/nixos/builder/default.nix new file mode 100644 index 0000000..66e2f36 --- /dev/null +++ b/modules/nixos/builder/default.nix @@ -0,0 +1,55 @@ +{ + # Snowfall Lib provides a customized `lib` instance with access to your flake's library + # as well as the libraries available from your flake's inputs. + lib, + # An instance of `pkgs` with your overlays and packages applied is also available. + pkgs, + # You also have access to your flake's inputs. + inputs, + + # Additional metadata is provided by Snowfall Lib. + namespace, # The namespace used for your flake, defaulting to "internal" if not set. + system, # The system architecture for this host (eg. `x86_64-linux`). + target, # The Snowfall Lib target for this system (eg. `x86_64-iso`). + format, # A normalized name for the system target (eg. `iso`). + virtual, # A boolean to determine whether this system is a virtual target using nixos-generators. + systems, # An attribute map of your defined hosts. + + # All other arguments come from the module system. + config, + ... +}: + +let + cfg = config.modules.builder; +in +{ + options.modules.builder = { + enable = lib.mkOption { default = false; }; + }; + + config = lib.mkIf cfg.enable { + nix.buildMachines = [ + { + hostName = "192.168.3.118"; + system = "x86_64-linux"; + protocol = "ssh"; + # if the builder supports building for multiple architectures, + # replace the previous line by, e.g. + # systems = ["x86_64-linux" "aarch64-linux"]; + maxJobs = 4; + speedFactor = 3; + supportedFeatures = [ + "nixos-test" + "benchmark" + "big-parallel" + "kvm" + ]; + mandatoryFeatures = [ ]; + } + ]; + nix.distributedBuilds = true; + # optional, useful when the builder has a faster internet connection than yours + nix.extraOptions = " builders-use-substitutes = true\n"; + }; +} diff --git a/modules/nixos/keymap/default.nix b/modules/nixos/keymap/default.nix new file mode 100644 index 0000000..02a184f --- /dev/null +++ b/modules/nixos/keymap/default.nix @@ -0,0 +1,42 @@ +{ + # Snowfall Lib provides a customized `lib` instance with access to your flake's library + # as well as the libraries available from your flake's inputs. + lib, + # An instance of `pkgs` with your overlays and packages applied is also available. + pkgs, + # You also have access to your flake's inputs. + inputs, + + # Additional metadata is provided by Snowfall Lib. + namespace, # The namespace used for your flake, defaulting to "internal" if not set. + system, # The system architecture for this host (eg. `x86_64-linux`). + target, # The Snowfall Lib target for this system (eg. `x86_64-iso`). + format, # A normalized name for the system target (eg. `iso`). + virtual, # A boolean to determine whether this system is a virtual target using nixos-generators. + systems, # An attribute map of your defined hosts. + + # All other arguments come from the module system. + config, + ... +}: + +let + cfg = config.modules.keymap; +in +{ + options.modules.keymap = { + enable = lib.mkOption { default = false; }; + }; + + config = lib.mkIf cfg.enable { + services.xserver = { + xkb.layout = "de"; + xkb.variant = ""; + }; + + # Configure console keymap + console.keyMap = "de"; + # or use this + # console.useXkbConfig = true; + }; +} diff --git a/modules/nixos/keyring/default.nix b/modules/nixos/keyring/default.nix new file mode 100644 index 0000000..fa8b11d --- /dev/null +++ b/modules/nixos/keyring/default.nix @@ -0,0 +1,35 @@ +{ + # Snowfall Lib provides a customized `lib` instance with access to your flake's library + # as well as the libraries available from your flake's inputs. + lib, + # An instance of `pkgs` with your overlays and packages applied is also available. + pkgs, + # You also have access to your flake's inputs. + inputs, + + # Additional metadata is provided by Snowfall Lib. + namespace, # The namespace used for your flake, defaulting to "internal" if not set. + system, # The system architecture for this host (eg. `x86_64-linux`). + target, # The Snowfall Lib target for this system (eg. `x86_64-iso`). + format, # A normalized name for the system target (eg. `iso`). + virtual, # A boolean to determine whether this system is a virtual target using nixos-generators. + systems, # An attribute map of your defined hosts. + + # All other arguments come from the module system. + config, + ... +}: + +let + cfg = config.modules.syncthing; +in +{ + options.modules.syncthing = { + enable = lib.mkOption { default = false; }; + }; + + config = lib.mkIf cfg.enable { + programs.seahorse.enable = true; + services.gnome.gnome-keyring.enable = true; + }; +} diff --git a/modules/nixos/nix-settings/default.nix b/modules/nixos/nix-settings/default.nix new file mode 100644 index 0000000..3c36aaf --- /dev/null +++ b/modules/nixos/nix-settings/default.nix @@ -0,0 +1,59 @@ +{ + # Snowfall Lib provides a customized `lib` instance with access to your flake's library + # as well as the libraries available from your flake's inputs. + lib, + # An instance of `pkgs` with your overlays and packages applied is also available. + pkgs, + # You also have access to your flake's inputs. + inputs, + + # Additional metadata is provided by Snowfall Lib. + namespace, # The namespace used for your flake, defaulting to "internal" if not set. + system, # The system architecture for this host (eg. `x86_64-linux`). + target, # The Snowfall Lib target for this system (eg. `x86_64-iso`). + format, # A normalized name for the system target (eg. `iso`). + virtual, # A boolean to determine whether this system is a virtual target using nixos-generators. + systems, # An attribute map of your defined hosts. + + # All other arguments come from the module system. + config, + ... +}: + +let + cfg = config.modules.nix-settings; +in +{ + options.modules.nix-settings = { + enable = lib.mkOption { default = false; }; + }; + + config = lib.mkIf cfg.enable { + nix.settings.auto-optimise-store = true; + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; + + # Setup binary caches + nix.settings = { + substituters = [ + "https://nix-community.cachix.org" + "https://cache.nixos.org/" + "https://hyprland.cachix.org" + ]; + trusted-public-keys = [ + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" + ]; + }; + + nix.gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 30d"; + }; + + programs.nix-ld.enable = true; + }; +} diff --git a/modules/nixos/polkit/default.nix b/modules/nixos/polkit/default.nix new file mode 100644 index 0000000..ba27b4b --- /dev/null +++ b/modules/nixos/polkit/default.nix @@ -0,0 +1,51 @@ +{ + # Snowfall Lib provides a customized `lib` instance with access to your flake's library + # as well as the libraries available from your flake's inputs. + lib, + # An instance of `pkgs` with your overlays and packages applied is also available. + pkgs, + # You also have access to your flake's inputs. + inputs, + + # Additional metadata is provided by Snowfall Lib. + namespace, # The namespace used for your flake, defaulting to "internal" if not set. + system, # The system architecture for this host (eg. `x86_64-linux`). + target, # The Snowfall Lib target for this system (eg. `x86_64-iso`). + format, # A normalized name for the system target (eg. `iso`). + virtual, # A boolean to determine whether this system is a virtual target using nixos-generators. + systems, # An attribute map of your defined hosts. + + # All other arguments come from the module system. + config, + ... +}: + +let + cfg = config.modules.syncthing; +in +{ + options.modules.syncthing = { + enable = lib.mkOption { default = false; }; + }; + + config = lib.mkIf cfg.enable { + security.polkit.enable = true; + + systemd = { + user.services.polkit-gnome-authentication-agent-1 = { + description = "polkit-gnome-authentication-agent-1"; + wantedBy = [ "graphical-session.target" ]; + wants = [ "graphical-session.target" ]; + after = [ "graphical-session.target" ]; + serviceConfig = { + Type = "simple"; + ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; + Restart = "on-failure"; + RestartSec = 1; + TimeoutStopSec = 10; + }; + }; + }; + + }; +} diff --git a/modules/nixos/sound/default.nix b/modules/nixos/sound/default.nix new file mode 100644 index 0000000..1ced03c --- /dev/null +++ b/modules/nixos/sound/default.nix @@ -0,0 +1,54 @@ +{ + # Snowfall Lib provides a customized `lib` instance with access to your flake's library + # as well as the libraries available from your flake's inputs. + lib, + # An instance of `pkgs` with your overlays and packages applied is also available. + pkgs, + # You also have access to your flake's inputs. + inputs, + + # Additional metadata is provided by Snowfall Lib. + namespace, # The namespace used for your flake, defaulting to "internal" if not set. + system, # The system architecture for this host (eg. `x86_64-linux`). + target, # The Snowfall Lib target for this system (eg. `x86_64-iso`). + format, # A normalized name for the system target (eg. `iso`). + virtual, # A boolean to determine whether this system is a virtual target using nixos-generators. + systems, # An attribute map of your defined hosts. + + # All other arguments come from the module system. + config, + ... +}: + +let + cfg = config.modules.sound; +in +{ + options.modules.sound = { + enable = lib.mkOption { default = false; }; + }; + + config = lib.mkIf cfg.enable { + sound.enable = true; + hardware.pulseaudio.enable = false; + + hardware.enableAllFirmware = true; + + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + extraConfig.pipewire = { + "99-no-bell" = { + # Disable bell sound + "context.properties" = { + "module.x11.bell" = false; + }; + }; + }; + }; + }; +} diff --git a/modules/nixos/syncthing/default.nix b/modules/nixos/syncthing/default.nix new file mode 100644 index 0000000..0e9a762 --- /dev/null +++ b/modules/nixos/syncthing/default.nix @@ -0,0 +1,65 @@ +{ + # Snowfall Lib provides a customized `lib` instance with access to your flake's library + # as well as the libraries available from your flake's inputs. + lib, + # An instance of `pkgs` with your overlays and packages applied is also available. + pkgs, + # You also have access to your flake's inputs. + inputs, + + # Additional metadata is provided by Snowfall Lib. + namespace, # The namespace used for your flake, defaulting to "internal" if not set. + system, # The system architecture for this host (eg. `x86_64-linux`). + target, # The Snowfall Lib target for this system (eg. `x86_64-iso`). + format, # A normalized name for the system target (eg. `iso`). + virtual, # A boolean to determine whether this system is a virtual target using nixos-generators. + systems, # An attribute map of your defined hosts. + + # All other arguments come from the module system. + config, + ... +}: + +let + cfg = config.modules.syncthing; +in +{ + options.modules.syncthing = { + enable = lib.mkOption { default = false; }; + }; + + config = lib.mkIf cfg.enable { + services.syncthing.enable = true; + services.syncthing.user = "julian"; + services.syncthing.openDefaultPorts = true; + services.syncthing.configDir = "/home/julian/.config/syncthing"; + # services.syncthing. + #services.syncthing.key = config.sops.secrets."aspi/syncthing/key".path; + #services.syncthing.cert = config.sops.secrets."aspi/syncthing/cert".path; + services.syncthing.overrideDevices = false; # overrides any devices added or deleted through the WebUI + services.syncthing.overrideFolders = false; # overrides any folders added or deleted through the WebUI + # services.syncthing.settings = { + # devices = { + # "pianopi" = { + # id = "FD3XSFW-7LQSCIQ-KHZPLNQ-7VZYGKH-RJ2ZKTJ-BG67NRH-36TQIZM-CXDYWAH"; + # }; + # }; + # folders = { + # "Documents" = { + # # Name of folder in Syncthing, also the folder ID + # path = "/home/myusername/Documents"; # Which folder to add to Syncthing + # devices = [ + # "device1" + # "device2" + # ]; # Which devices to share the folder with + # }; + # "Example" = { + # path = "/home/myusername/Example"; + # devices = [ "device1" ]; + # ignorePerms = false; # By default, Syncthing doesn't sync file permissions. This line enables it for this folder. + # }; + # }; + # }; + + }; +} diff --git a/modules/nixos/users-julian/default.nix b/modules/nixos/users-julian/default.nix new file mode 100644 index 0000000..69d4945 --- /dev/null +++ b/modules/nixos/users-julian/default.nix @@ -0,0 +1,49 @@ +{ + # Snowfall Lib provides a customized `lib` instance with access to your flake's library + # as well as the libraries available from your flake's inputs. + lib, + # An instance of `pkgs` with your overlays and packages applied is also available. + pkgs, + # You also have access to your flake's inputs. + inputs, + + # Additional metadata is provided by Snowfall Lib. + namespace, # The namespace used for your flake, defaulting to "internal" if not set. + system, # The system architecture for this host (eg. `x86_64-linux`). + target, # The Snowfall Lib target for this system (eg. `x86_64-iso`). + format, # A normalized name for the system target (eg. `iso`). + virtual, # A boolean to determine whether this system is a virtual target using nixos-generators. + systems, # An attribute map of your defined hosts. + + # All other arguments come from the module system. + config, + ... +}: + +let + cfg = config.modules.users-julian; +in +{ + options.modules.users-julian = { + enable = lib.mkOption { default = false; }; + }; + + config = lib.mkIf cfg.enable { + users.users.julian = { + isNormalUser = true; + description = "Julian"; + uid = 1000; + group = "julian"; + shell = pkgs.fish; + extraGroups = [ + "networkmanager" + "wheel" + "docker" + ]; + }; + programs.fish.enable = true; + users.groups.julian = { + gid = 1000; + }; + }; +} diff --git a/modules/nixos/virtualbox/default.nix b/modules/nixos/virtualbox/default.nix new file mode 100644 index 0000000..2b532f9 --- /dev/null +++ b/modules/nixos/virtualbox/default.nix @@ -0,0 +1,38 @@ +{ + # Snowfall Lib provides a customized `lib` instance with access to your flake's library + # as well as the libraries available from your flake's inputs. + lib, + # An instance of `pkgs` with your overlays and packages applied is also available. + pkgs, + # You also have access to your flake's inputs. + inputs, + + # Additional metadata is provided by Snowfall Lib. + namespace, # The namespace used for your flake, defaulting to "internal" if not set. + system, # The system architecture for this host (eg. `x86_64-linux`). + target, # The Snowfall Lib target for this system (eg. `x86_64-iso`). + format, # A normalized name for the system target (eg. `iso`). + virtual, # A boolean to determine whether this system is a virtual target using nixos-generators. + systems, # An attribute map of your defined hosts. + + # All other arguments come from the module system. + config, + ... +}: + +let + cfg = config.modules.virtualbox; +in +{ + options.modules.virtualbox = { + enable = lib.mkOption { default = false; }; + }; + + config = lib.mkIf cfg.enable { + virtualisation.virtualbox.host.enable = true; + # virtualisation.virtualbox.host.enableExtensionPack = true; + # virtualisation.virtualbox.guest.enable = true; + # virtualisation.virtualbox.guest.x11 = true; + users.extraGroups.vboxusers.members = [ "julian" ]; + }; +} diff --git a/modules/nixos/xdg-portal/default.nix b/modules/nixos/xdg-portal/default.nix new file mode 100644 index 0000000..06fe864 --- /dev/null +++ b/modules/nixos/xdg-portal/default.nix @@ -0,0 +1,37 @@ +{ + # Snowfall Lib provides a customized `lib` instance with access to your flake's library + # as well as the libraries available from your flake's inputs. + lib, + # An instance of `pkgs` with your overlays and packages applied is also available. + pkgs, + # You also have access to your flake's inputs. + inputs, + + # Additional metadata is provided by Snowfall Lib. + namespace, # The namespace used for your flake, defaulting to "internal" if not set. + system, # The system architecture for this host (eg. `x86_64-linux`). + target, # The Snowfall Lib target for this system (eg. `x86_64-iso`). + format, # A normalized name for the system target (eg. `iso`). + virtual, # A boolean to determine whether this system is a virtual target using nixos-generators. + systems, # An attribute map of your defined hosts. + + # All other arguments come from the module system. + config, + ... +}: + +let + cfg = config.modules.syncthing; +in +{ + options.modules.syncthing = { + enable = lib.mkOption { default = false; }; + }; + + config = lib.mkIf cfg.enable { + xdg.portal.enable = true; + xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + xdg.portal.config.common.default = "*"; # Use first portal implementation found + # hyprland desktop portal added automatically + }; +} diff --git a/modules/nixos/xserver-defaults/default.nix b/modules/nixos/xserver-defaults/default.nix new file mode 100644 index 0000000..3184e5b --- /dev/null +++ b/modules/nixos/xserver-defaults/default.nix @@ -0,0 +1,43 @@ +{ + # Snowfall Lib provides a customized `lib` instance with access to your flake's library + # as well as the libraries available from your flake's inputs. + lib, + # An instance of `pkgs` with your overlays and packages applied is also available. + pkgs, + # You also have access to your flake's inputs. + inputs, + + # Additional metadata is provided by Snowfall Lib. + namespace, # The namespace used for your flake, defaulting to "internal" if not set. + system, # The system architecture for this host (eg. `x86_64-linux`). + target, # The Snowfall Lib target for this system (eg. `x86_64-iso`). + format, # A normalized name for the system target (eg. `iso`). + virtual, # A boolean to determine whether this system is a virtual target using nixos-generators. + systems, # An attribute map of your defined hosts. + + # All other arguments come from the module system. + config, + ... +}: + +let + cfg = config.modules.xserver-defaults; +in +{ + options.modules.xserver-defaults = { + enable = lib.mkOption { default = false; }; + }; + + config = lib.mkIf cfg.enable { + services.xserver = { + enable = true; + wacom.enable = true; + + # Keymap + xkb.layout = "de"; + xkb.variant = ""; + }; + + hardware.opengl.enable = true; + }; +} diff --git a/systems/x86_64-linux/aspi/default.nix b/systems/x86_64-linux/aspi/default.nix index 16ffdf1..01560d3 100644 --- a/systems/x86_64-linux/aspi/default.nix +++ b/systems/x86_64-linux/aspi/default.nix @@ -22,54 +22,26 @@ { imports = [ ./hardware-configuration.nix ]; - # nix.buildMachines = [ - # { - # hostName = "192.168.3.118"; - # system = "x86_64-linux"; - # protocol = "ssh"; - # # if the builder supports building for multiple architectures, - # # replace the previous line by, e.g. - # # systems = ["x86_64-linux" "aarch64-linux"]; - # maxJobs = 4; - # speedFactor = 3; - # supportedFeatures = [ - # "nixos-test" - # "benchmark" - # "big-parallel" - # "kvm" - # ]; - # mandatoryFeatures = [ ]; - # } - # ]; - # nix.distributedBuilds = true; - # # optional, useful when the builder has a faster internet connection than yours - # nix.extraOptions = " builders-use-substitutes = true\n"; - - # Bootloader - modules.system.boot-efi.enable = true; - boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; - boot.supportedFilesystems = [ - "btrfs" - "ntfs" - "nfs" - "cifs" - ]; - boot.blacklistedKernelModules = [ "pcspkr" ]; # Disables "beep" networking.hostName = "aspi"; - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. networking.networkmanager.enable = true; topology.self = { hardware.info = "ThinkPad L430, 8GB RAM"; }; - # Set your time zone. time.timeZone = "Europe/Berlin"; modules = { + nix-settings.enable = true; + xserver-defaults.enable = true; + keymap.enable = true; + builder.enable = false; + modules.system.boot-efi.enable = true; + sound.enable = true; + locales.enable = true; # thunar.enable = true; pcmanfm.enable = true; @@ -80,43 +52,13 @@ # wayland.enable = true; # hyprland.enable = true; # tuigreet.enable = true; - }; - nix.settings.auto-optimise-store = true; - nix.settings.experimental-features = [ - "nix-command" - "flakes" - ]; - - # Setup binary caches - nix.settings = { - substituters = [ - "https://nix-community.cachix.org" - "https://cache.nixos.org/" - "https://hyprland.cachix.org" - ]; - trusted-public-keys = [ - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" - ]; - }; - - hardware.opengl.enable = true; - - services.xserver.wacom.enable = true; - - services.xserver = { - enable = true; - - # Configure keymap in X11 - xkb.layout = "de"; - xkb.variant = ""; - }; - - nix.gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 30d"; + virtualbox.enable = true; + users-julian.enable = true; + syncthing.enable = true; + xdg-portal.enable = true; + polkit.enable = true; + keyring.enable = true; }; services.blueman.enable = true; @@ -133,83 +75,11 @@ # Enable touchpad support (enabled default in most desktopManager). services.libinput.enable = true; - # Configure console keymap - console.keyMap = "de"; - # or use this - # console.useXkbConfig = true; - - security.polkit.enable = true; - - systemd = { - user.services.polkit-gnome-authentication-agent-1 = { - description = "polkit-gnome-authentication-agent-1"; - wantedBy = [ "graphical-session.target" ]; - wants = [ "graphical-session.target" ]; - after = [ "graphical-session.target" ]; - serviceConfig = { - Type = "simple"; - ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; - Restart = "on-failure"; - RestartSec = 1; - TimeoutStopSec = 10; - }; - }; - }; - - # Sound - sound.enable = true; - hardware.pulseaudio.enable = false; - - # needed on aspi for audio to work properly - hardware.enableAllFirmware = true; - - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - jack.enable = true; - extraConfig.pipewire = { - "99-no-bell" = { - # Disable bell sound - "context.properties" = { - "module.x11.bell" = false; - }; - }; - }; - }; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.julian = { - isNormalUser = true; - description = "Julian"; - uid = 1000; - group = "julian"; - shell = pkgs.fish; - extraGroups = [ - "networkmanager" - "wheel" - "docker" - "audio" - ]; - }; - - # home-manager.useGlobalPkgs = true; # make overlays for nixpkgs work for home-manager, not only the system - # home-manager.useUserPackages = true; - - programs.fish.enable = true; - - programs.nix-ld.enable = true; - - users.groups.julian = { - gid = 1000; - }; - - programs.seahorse.enable = true; - services.gnome.gnome-keyring.enable = true; - # systemd.services."wg-quick@julian".enable = true; + + xdg.portal.enable = true; + xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + xdg.portal.config.common.default = "*"; # Use first portal implementation found # networking.wireguard.enable = true; # This interface is started on boot / switch @@ -223,45 +93,8 @@ # Enable the OpenSSH daemon. services.openssh.enable = false; - services.syncthing.enable = true; - services.syncthing.user = "julian"; - services.syncthing.openDefaultPorts = true; - services.syncthing.configDir = "/home/julian/.config/syncthing"; - # services.syncthing. - #services.syncthing.key = config.sops.secrets."aspi/syncthing/key".path; - #services.syncthing.cert = config.sops.secrets."aspi/syncthing/cert".path; - services.syncthing.overrideDevices = false; # overrides any devices added or deleted through the WebUI - services.syncthing.overrideFolders = false; # overrides any folders added or deleted through the WebUI - # services.syncthing.settings = { - # devices = { - # "pianopi" = { - # id = "FD3XSFW-7LQSCIQ-KHZPLNQ-7VZYGKH-RJ2ZKTJ-BG67NRH-36TQIZM-CXDYWAH"; - # }; - # }; - # folders = { - # "Documents" = { - # # Name of folder in Syncthing, also the folder ID - # path = "/home/myusername/Documents"; # Which folder to add to Syncthing - # devices = [ - # "device1" - # "device2" - # ]; # Which devices to share the folder with - # }; - # "Example" = { - # path = "/home/myusername/Example"; - # devices = [ "device1" ]; - # ignorePerms = false; # By default, Syncthing doesn't sync file permissions. This line enables it for this folder. - # }; - # }; - # }; - services.flatpak.enable = true; - xdg.portal.enable = true; - xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; - xdg.portal.config.common.default = "*"; # Use first portal implementation found - # hyprland desktop portal added automatically - # services.emacs.enable = true; # services.gnome.gnome-keyring.enable = true; @@ -285,26 +118,6 @@ virtualisation.docker.enable = true; - virtualisation.virtualbox.host.enable = true; - # virtualisation.virtualbox.host.enableExtensionPack = true; - # virtualisation.virtualbox.guest.enable = true; - # virtualisation.virtualbox.guest.x11 = true; - users.extraGroups.vboxusers.members = [ "julian" ]; - - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - # ======================== DO NOT CHANGE THIS ======================== system.stateVersion = "24.05"; # ======================== DO NOT CHANGE THIS ======================== diff --git a/systems/x86_64-linux/kardorf/default.nix b/systems/x86_64-linux/kardorf/default.nix index 01facde..1931272 100644 --- a/systems/x86_64-linux/kardorf/default.nix +++ b/systems/x86_64-linux/kardorf/default.nix @@ -13,120 +13,43 @@ { imports = [ ./hardware-configuration.nix ]; - nix.buildMachines = [ - { - hostName = "192.168.3.118"; - system = "x86_64-linux"; - protocol = "ssh"; - # if the builder supports building for multiple architectures, - # replace the previous line by, e.g. - # systems = ["x86_64-linux" "aarch64-linux"]; - maxJobs = 4; - speedFactor = 3; - supportedFeatures = [ - "nixos-test" - "benchmark" - "big-parallel" - "kvm" - ]; - mandatoryFeatures = [ ]; - } - ]; - nix.distributedBuilds = true; - # optional, useful when the builder has a faster internet connection than yours - nix.extraOptions = " builders-use-substitutes = true\n"; - - # Bootloader - # Use this for simple nix boot menu, if no dual boot required - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - boot.loader.efi.efiSysMountPoint = "/boot/efi"; - - modules.system.boot-efi.enable = true; - - boot.supportedFilesystems = [ - "btrfs" - "ntfs" - "nfs" - "cifs" - ]; - networking.hostName = "kardorf"; # Define your hostname. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - - # Enable networking networking.networkmanager.enable = true; - # Set your time zone. + topology.self = { + hardware.info = "Pc Kardorf"; + }; + time.timeZone = "Europe/Berlin"; + modules = { + nix-settings.enable = true; + xserver-defaults.enable = true; + keymap.enable = true; + builder.enable = true; + system.boot-efi.enable = true; + sound.enable = true; + locales.enable = true; + pcmanfm.enable = true; + i3.enable = true; + gdm.enable = true; + virtualbox.enable = true; + users-julian.enable = true; + xdg-portal.enable = true; + polkit.enable = true; + keyring.enable = true; + }; + # Set location used by redshift location.provider = "manual"; location.latitude = 47.92; location.longitude = 10.12; + services.redshift.enable = true; - modules = { - locales.enable = true; - pcmanfm.enable = true; - # wayland.enable = true; - # hyprland.enable = true; - }; - - nix.settings.auto-optimise-store = true; - nix.settings.experimental-features = [ - "nix-command" - "flakes" - ]; - - # Setup binary caches - nix.settings = { - substituters = [ - "https://nix-community.cachix.org" - "https://cache.nixos.org/" - ]; - trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ]; - }; - - # Enable the X11 windowing system. - services.xserver.enable = true; services.xserver.videoDrivers = [ "nvidia" ]; hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.legacy_470; - hardware.opengl.enable = true; # hardware.nvidia.modesetting.enable = true; # for wayland - nix.gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 30d"; - }; - - # Enable the XFCE Desktop Environment. - services.xserver.displayManager.lightdm.enable = true; - services.xserver.desktopManager = { - xterm.enable = false; - xfce = { - enable = true; - noDesktop = true; - enableXfwm = false; - }; - }; - services.displayManager.defaultSession = "none+i3"; - services.xserver.windowManager.i3.enable = true; - services.xserver.windowManager.i3.package = pkgs.i3-gaps; - - # Configure keymap in X11 - services.xserver = { - xkb.layout = "de"; - xkb.variant = ""; - }; - - # Configure console keymap - console.keyMap = "de"; - # Enable CUPS to print documents. # hardware.sane.enable = true; services.printing.enable = true; @@ -135,51 +58,6 @@ # services.avahi.nssmdns = true; services.printing.drivers = with pkgs; [ gutenprint ]; - # Enable sound with pipewire. - sound.enable = true; - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - # If you want to use JACK applications, uncomment this - #jack.enable = true; - - # use the example session manager (no others are packaged yet so this is enabled by default, - # no need to redefine it in your config for now) - #media-session.enable = true; - }; - - # Enable touchpad support (enabled default in most desktopManager). - # services.libinput.enable = true; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.julian = { - isNormalUser = true; - description = "Julian"; - uid = 1000; - group = "julian"; - shell = pkgs.fish; - extraGroups = [ - "networkmanager" - "wheel" - "docker" - ]; - }; - - # home-manager.useGlobalPkgs = true; # make overlays for nixpkgs work for home-manager, not only the system - # home-manager.useUserPackages = true; - - programs.fish.enable = true; - # programs.zsh.enable = true; - - programs.nix-ld.enable = true; - - users.groups.julian = { - gid = 1000; - }; # users.groups.wolfi = { gid = 1001; }; # users.users.wolfi = { @@ -191,32 +69,17 @@ # extraGroups = [ "networkmanager" "wheel" ]; # }; - environment.etc."manual-links/xfce4-notifyd".source = "${pkgs.xfce.xfce4-notifyd}/lib/xfce4/notifyd/xfce4-notifyd"; - environment.etc."manual-links/polkit-gnome-authentication-agent-1".source = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; - # List services that you want to enable: # Enable the OpenSSH daemon. services.openssh.enable = false; - services.syncthing.enable = true; - services.syncthing.user = "julian"; - services.syncthing.group = "julian"; - - services.redshift.enable = true; - services.flatpak.enable = true; # Smart card reader services.pcscd.enable = true; - xdg.portal.enable = true; - xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; - xdg.portal.config.common.default = "*"; # Use first portal implementation found - # services.emacs.enable = true; - services.gnome.gnome-keyring.enable = true; - # List packages installed in system profile. To search, run: # $ nix search wget @@ -229,31 +92,7 @@ virtualisation.docker.enable = true; - virtualisation.virtualbox.host.enable = true; - # virtualisation.virtualbox.host.enableExtensionPack = true; - # virtualisation.virtualbox.guest.enable = true; - # virtualisation.virtualbox.guest.x11 = true; - users.extraGroups.vboxusers.members = [ "julian" ]; - - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "22.11"; # Did you read the comment? + # ======================== DO NOT CHANGE THIS ======================== + system.stateVersion = "22.11"; + # ======================== DO NOT CHANGE THIS ======================== }