diff --git a/flake.lock b/flake.lock index 91194c1..ff8c6fd 100644 --- a/flake.lock +++ b/flake.lock @@ -99,11 +99,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1772479524, - "narHash": "sha256-U+hMRvavBzJYhdWCWGRHCK3bpcKjqTJAnyii3y09uT8=", - "rev": "4215e62dc2cd3bc705b0a423b9719ff6be378a43", + "lastModified": 1772525000, + "narHash": "sha256-JVA3N5t5II0xI9+sJ44UgaN6tMrZGOox0w2xZzKYt9Q=", + "rev": "72b1d820cb0149b40a35aa077b4b6d60cd1b23c3", "type": "tarball", - "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre957146.4215e62dc2cd/nixexprs.tar.xz" + "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre957475.72b1d820cb01/nixexprs.tar.xz" }, "original": { "type": "tarball", diff --git a/flake.nix b/flake.nix index 0c9ac25..1632df0 100644 --- a/flake.nix +++ b/flake.nix @@ -22,9 +22,5 @@ inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; - systems = [ - "aarch64-darwin" - "x86_64-linux" - ]; } (inputs.import-tree ./modules); } diff --git a/hosts/dnsc-machine/default.nix b/hosts/dnsc-machine/default.nix new file mode 100644 index 0000000..986f7da --- /dev/null +++ b/hosts/dnsc-machine/default.nix @@ -0,0 +1,11 @@ +{ ... }: + +{ + imports = [ + ./hardware-configuration.nix + ]; + + networking.hostName = "dnsc-machine"; + environment.systemPackages = [ ]; + system.stateVersion = "25.05"; +} diff --git a/hosts/dnsc-machine/hardware-configuration.nix b/hosts/dnsc-machine/hardware-configuration.nix new file mode 100644 index 0000000..0e059e0 --- /dev/null +++ b/hosts/dnsc-machine/hardware-configuration.nix @@ -0,0 +1,41 @@ +# Do not modify this file! It was generated by 'nixos-generate-config' +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/30277f94-8b7b-4e91-8438-6815170edfdd"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/4DC9-7AB7"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/9b7564e7-2deb-4432-a4fc-d18d21ef2d11"; } + ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp42s0.useDHCP = lib.mkDefault true; + # networking.interfaces.enp45s0f3u3u4.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/modules/darwin-system.nix b/modules/base.nix similarity index 56% rename from modules/darwin-system.nix rename to modules/base.nix index 3f96cf2..1307d8b 100644 --- a/modules/darwin-system.nix +++ b/modules/base.nix @@ -3,7 +3,7 @@ let username = config.flake.globalConfig.username; in { - flake.modules.darwin.system = { + flake.modules.darwin.base = { system = { primaryUser = username; stateVersion = 5; @@ -11,6 +11,8 @@ in /System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u ''; + nix.enable = false; + defaults = { NSGlobalDomain."com.apple.swipescrolldirection" = false; @@ -62,4 +64,54 @@ in security.pam.services.sudo_local.touchIdAuth = true; }; + + flake.modules.nixos.base = + { pkgs, ... }: + { + boot.loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + + networking.networkmanager.enable = true; + + time.timeZone = "Europe/Berlin"; + i18n = { + defaultLocale = "en_US.UTF-8"; + extraLocaleSettings = { + LC_ADDRESS = "de_DE.UTF-8"; + LC_IDENTIFICATION = "de_DE.UTF-8"; + LC_MEASUREMENT = "de_DE.UTF-8"; + LC_MONETARY = "de_DE.UTF-8"; + LC_NAME = "de_DE.UTF-8"; + LC_NUMERIC = "de_DE.UTF-8"; + LC_PAPER = "de_DE.UTF-8"; + LC_TELEPHONE = "de_DE.UTF-8"; + LC_TIME = "de_DE.UTF-8"; + }; + }; + + security.sudo.enable = true; + + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + programs.mtr.enable = true; + + services.xserver.xkb.layout = "eu"; + services.openssh.enable = true; + services.udisks2.enable = true; + services.udev.packages = with pkgs; [ + vial + ]; + + users.users."${username}" = { + isNormalUser = true; + extraGroups = [ + "networkmanager" + "wheel" + ]; + }; + }; } diff --git a/modules/base/default.nix b/modules/base/default.nix new file mode 100644 index 0000000..4f3b8f2 --- /dev/null +++ b/modules/base/default.nix @@ -0,0 +1,112 @@ +{ config, ... }: +let + username = config.flake.globalConfig.username; +in +{ + flake.modules.darwin.system = + { pkgs }: + { + system = { + primaryUser = username; + stateVersion = 5; + activationScripts.postActivation.text = '' + /System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u + ''; + + defaults = { + NSGlobalDomain."com.apple.swipescrolldirection" = false; + + dock = { + autohide = true; + autohide-delay = 0.01; + autohide-time-modifier = 0.01; + expose-group-apps = true; + launchanim = false; + minimize-to-application = true; + orientation = "right"; + show-recents = false; + persistent-apps = [ + "/Applications/Helium.app" + "/Applications/Ghostty.app" + "/System/Applications/System Settings.app/" + ]; + persistent-others = [ + "/Users/${username}/Downloads" + ]; + }; + + finder = { + AppleShowAllExtensions = true; + CreateDesktop = false; + FXEnableExtensionChangeWarning = false; + FXPreferredViewStyle = "clmv"; + ShowPathbar = true; + ShowStatusBar = true; + }; + + loginwindow = { + LoginwindowText = "(λ) powered by nix-darwin"; + }; + + menuExtraClock = { + Show24Hour = true; + ShowDate = 0; + }; + + screencapture = { + location = "/Users/${username}/Downloads"; + target = "file"; + }; + + spaces.spans-displays = false; + }; + }; + + security.pam.services.sudo_local.touchIdAuth = true; + }; + + flake.modules.nixos.system = + { pkgs }: + { + boot.loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + + networking.networkmanager.enable = true; + i18n = { + defaultLocale = "en_US.UTF-8"; + extraLocaleSettings = { + LC_ADDRESS = "de_DE.UTF-8"; + LC_IDENTIFICATION = "de_DE.UTF-8"; + LC_MEASUREMENT = "de_DE.UTF-8"; + LC_MONETARY = "de_DE.UTF-8"; + LC_NAME = "de_DE.UTF-8"; + LC_NUMERIC = "de_DE.UTF-8"; + LC_PAPER = "de_DE.UTF-8"; + LC_TELEPHONE = "de_DE.UTF-8"; + LC_TIME = "de_DE.UTF-8"; + }; + }; + + security.sudo.enable = true; + + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + programs.mtr.enable = true; + + services.xserver.xkb.layout = "eu"; + services.openssh.enable = true; + services.udisks2.enable = true; + + users.users."${username}" = { + isNormalUser = true; + extraGroups = [ + "networkmanager" + "wheel" + ]; + }; + }; +} diff --git a/modules/config.nix b/modules/config.nix index 5850750..a490509 100644 --- a/modules/config.nix +++ b/modules/config.nix @@ -1,5 +1,11 @@ { lib, ... }: { + options.flake.modules = lib.mkOption { + type = lib.types.attrsOf (lib.types.lazyAttrsOf lib.types.raw); + default = { }; + description = "Reusable NixOS/Darwin/home-manager modules keyed by type and name"; + }; + options.flake.globalConfig = { username = lib.mkOption { type = lib.types.str; diff --git a/modules/hosts/dnsc-air.nix b/modules/hosts/dnsc-air.nix index 8784c24..2f2c661 100644 --- a/modules/hosts/dnsc-air.nix +++ b/modules/hosts/dnsc-air.nix @@ -4,6 +4,7 @@ ... }: let + hostname = "dnsc-air"; username = config.flake.globalConfig.username; in { @@ -12,10 +13,10 @@ in specialArgs = { inherit inputs; }; modules = [ inputs.home-manager.darwinModules.home-manager - config.flake.modules.darwin.system + config.flake.modules.darwin.base { - networking.hostName = "dnsc-air"; - networking.computerName = "dnsc-air"; + networking.hostName = "${hostname}"; + networking.computerName = "${hostname}"; users.users.${username}.home = "/Users/${username}"; nix.enable = false; nix.settings.experimental-features = [ diff --git a/modules/hosts/dnsc-machine.nix b/modules/hosts/dnsc-machine.nix new file mode 100644 index 0000000..f65631b --- /dev/null +++ b/modules/hosts/dnsc-machine.nix @@ -0,0 +1,11 @@ +{ inputs, ... }: + +{ + flake.nixosConfigurations.dnsc-machine = inputs.nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = with inputs.self.modules.nixos; [ + base + "${inputs.self}/hosts/dnsc-machine/default.nix" + ]; + }; +} diff --git a/modules/neovim/default.nix b/modules/neovim/default.nix index c5ffad7..eae14f8 100644 --- a/modules/neovim/default.nix +++ b/modules/neovim/default.nix @@ -1,10 +1,9 @@ { inputs, - pkgs, ... }: { - flake.modules.homeManager.neovim = { + flake.modules.homeManager.neovim = { pkgs, ... }: { imports = [ inputs.nixvim.homeModules.nixvim ]; programs.nixvim = { enable = true; diff --git a/modules/neovim/editing.nix b/modules/neovim/editing.nix index f9775da..c1f984a 100644 --- a/modules/neovim/editing.nix +++ b/modules/neovim/editing.nix @@ -1,6 +1,6 @@ -{ pkgs, ... }: +{ ... }: { - flake.modules.homeManager.neovim-editing = { + flake.modules.homeManager.neovim-editing = { pkgs, ... }: { programs.nixvim = { plugins.sleuth.enable = true; plugins.nvim-surround.enable = true; diff --git a/modules/neovim/formatter.nix b/modules/neovim/formatter.nix index 8b5de93..df2fb8d 100644 --- a/modules/neovim/formatter.nix +++ b/modules/neovim/formatter.nix @@ -1,6 +1,6 @@ -{ pkgs, ... }: +{ ... }: { - flake.modules.homeManager.neovim-formatter = { + flake.modules.homeManager.neovim-formatter = { pkgs, ... }: { programs.nixvim.plugins.conform-nvim = { enable = true; settings = { diff --git a/modules/neovim/lsp.nix b/modules/neovim/lsp.nix index a652c90..61861b4 100644 --- a/modules/neovim/lsp.nix +++ b/modules/neovim/lsp.nix @@ -1,6 +1,6 @@ -{ pkgs, ... }: +{ ... }: { - flake.modules.homeManager.neovim-lsp = { + flake.modules.homeManager.neovim-lsp = { pkgs, ... }: { programs.nixvim = { plugins.lspconfig.enable = true; diff --git a/modules/neovim/picker.nix b/modules/neovim/picker.nix index 5273ab6..dd7dd06 100644 --- a/modules/neovim/picker.nix +++ b/modules/neovim/picker.nix @@ -1,6 +1,6 @@ -{ pkgs, ... }: +{ ... }: { - flake.modules.homeManager.neovim-picker = { + flake.modules.homeManager.neovim-picker = { pkgs, ... }: { programs.nixvim = { plugins.oil = { enable = true; diff --git a/modules/systems.nix b/modules/systems.nix new file mode 100644 index 0000000..4ea5bf3 --- /dev/null +++ b/modules/systems.nix @@ -0,0 +1,7 @@ +{ ... }: +{ + systems = [ + "aarch64-darwin" + "x86_64-linux" + ]; +} diff --git a/modules/vial/default.nix b/modules/vial/default.nix new file mode 100644 index 0000000..9524fa7 --- /dev/null +++ b/modules/vial/default.nix @@ -0,0 +1,12 @@ +{ + flake.modules.nixos.vial = + { pkgs }: + { + environment.systemPackages = with pkgs; [ + vial + ]; + services.udev.packages = with pkgs; [ + vial + ]; + }; +}