Nix Flakes configuration for MacOS, NixOS and WSL
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor: rename modules and remove `flake.modules` to use native ones

cosmeak 0f484c60 49590bc0

+124 -60
+2 -3
flake.nix
··· 1 1 { 2 2 inputs = { 3 - # Packages 3 + # Packages and Nixos modules 4 4 nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11"; 5 5 6 6 # Macos modules ··· 17 17 18 18 outputs = inputs@{ flake-parts, ... }: 19 19 flake-parts.lib.mkFlake { inherit inputs; } { 20 + systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ]; 20 21 imports = [ 21 - flake-parts.flakeModules.modules 22 22 ./modules 23 23 ]; 24 - systems = [ "x86_64-linux" "aarch64-darwin" ]; 25 24 }; 26 25 }
+1 -1
modules/features/audio.nix
··· 1 1 { lib, ... }: 2 2 { 3 - flake.modules.nixos.audio = { ... }: { 3 + flake.nixosModules.audio = { ... }: { 4 4 services.pulseaudio.enable = lib.mkForce false; 5 5 security.rtkit.enable = true; 6 6 services.pipewire = {
+13
modules/features/development.nix
··· 1 + { 2 + flake.nixosModules.development = { pkgs, ... }: { 3 + environment.systemPackages = with pkgs; [ 4 + dbeaver-bin # Database client 5 + bruno # IDE for testing apis 6 + helix # TUI code editor 7 + lazygit # TUI git 8 + podman # container tool -> replacement of docker 9 + podman-compose # compose provider for podman 10 + (zed-editor.fhsWithPackages (pkg: [ zlib ])) # GUI code editor 11 + ]; 12 + }; 13 + }
+2 -2
modules/features/garbage-collector.nix
··· 1 1 { 2 - flake.modules.nixos.garbageCollector = { ... }: { 2 + flake.nixosModules.garbageCollector = { ... }: { 3 3 nix.settings.auto-optimise-store = true; 4 4 nix.gc = { 5 5 automatic = true; ··· 8 8 }; 9 9 }; 10 10 11 - flake.modules.darwin.garbageCollector = { ... }: { 11 + flake.darwinModules.garbageCollector = { ... }: { 12 12 nix.gc = { 13 13 automatic = true; 14 14 interval = [{ Weekday = 7; }];
+5 -3
modules/features/gnome-desktop.nix
··· 1 1 { 2 2 # Minimal gnome desktop 3 - flake.modules.nixos.gnome-desktop = { inputs, pkgs, ... }: { 4 - imports = with inputs.self.modules.nixos; [ 3 + flake.nixosModules.gnome-desktop = { inputs, pkgs, ... }: { 4 + imports = with inputs.self.nixosModules; [ 5 5 audio 6 6 ]; 7 7 ··· 9 9 services.displayManager.autoLogin.enable = true; 10 10 services.displayManager.autoLogin.user = "cosmeak"; 11 11 services.desktopManager.gnome.enable = true; 12 + 13 + # We don't want extra packages, just the bare minimum 12 14 services.gnome.games.enable = false; 13 15 services.gnome.core-developer-tools.enable = false; 14 16 services.gnome.core-apps.enable = false; 15 17 environment.gnome.excludePackages = with pkgs; [ gnome-tour gnome-user-docs ]; 16 - environment.systemPackages = with pkgs; [ nautilus ]; 18 + environment.systemPackages = with pkgs; [ nautilus loupe ]; 17 19 }; 18 20 }
+1 -1
modules/features/grub.nix
··· 1 1 { 2 - flake.modules.nixos.grub = { ... }: { 2 + flake.nixosModules.grub = { ... }: { 3 3 boot.loader.grub.enable = true; 4 4 boot.loader.grub.device = "nodev"; 5 5 boot.loader.grub.useOSProber = true;
+2 -2
modules/features/kde-desktop.nix
··· 1 1 { 2 - flake.modules.nixos.kde-desktop = { inputs, ... }: { 3 - imports = with inputs.self.modules.nixos; [ 2 + flake.nixosModules.kde-desktop = { inputs, ... }: { 3 + imports = with inputs.self.nixosModules; [ 4 4 audio 5 5 ]; 6 6
+1 -1
modules/features/nvidia-gpu.nix
··· 2 2 { 3 3 allowedUnfreePackages = [ "nvidia-x11" "nvidia-settings" ]; 4 4 5 - flake.modules.nixos.nvidia-gpu = { config, ... }: { 5 + flake.nixosModules.nvidia-gpu = { config, ... }: { 6 6 hardware.nvidia = { 7 7 package = config.boot.kernelPackages.nvidiaPackages.latest; 8 8 modesetting.enable = true;
+9
modules/features/photo-editing.nix
··· 1 + { 2 + flake.nixosModules.photo-editing = { pkgs, ... }: { 3 + environment.systemPackages = with pkgs; [ krita ]; 4 + }; 5 + 6 + flake.darwinModules.photo-editing = { ... }: { 7 + homebrew.casks = [ "krita" ]; 8 + }; 9 + }
+1 -1
modules/features/systemd-boot.nix
··· 1 1 { 2 2 # EFI Bootloader 3 - flake.modules.nixos.systemd-boot = { ... }: { 3 + flake.nixosModules.systemd-boot = { ... }: { 4 4 boot.loader.systemd-boot.enable = true; 5 5 boot.loader.efi.canTouchEfiVariables = true; 6 6 boot.loader.systemd-boot.configurationLimit = 10;
+2 -2
modules/features/unfree.nix
··· 8 8 }; 9 9 10 10 config = let packages = config.allowedUnfreePackages; in { 11 - flake.modules.nixos.unfree-packages = { lib, ... }: { 11 + flake.nixosModules.unfree-packages = { lib, ... }: { 12 12 nixpkgs.config.allowUnfreePredicate = pkg: 13 13 builtins.elem (lib.getName pkg) packages; 14 14 }; 15 15 16 - flake.modules.darwin.unfree-packages = { lib, ... }: { 16 + flake.darwinModules.unfree-packages = { lib, ... }: { 17 17 nixpkgs.config.allowUnfreePredicate = pkg: 18 18 builtins.elem (lib.getName pkg) packages; 19 19 };
+10
modules/features/video-editing.nix
··· 1 + { 2 + flake.nixosModules.video-editing = { pkgs, ... }: { 3 + environment.systemPackages = with pkgs; [ davinci-resolve ]; 4 + }; 5 + 6 + flake.darwinModules.video-editing = { ... }: { 7 + # Davinci resolve is not available for darwin in nixpkgs nor in homebrew. 8 + # todo: search for a simple installation through nix. 9 + }; 10 + }
+1 -1
modules/hosts/andhrimnir/configuration.nix
··· 5 5 modules = [ 6 6 ({ pkgs, ... }: { 7 7 imports = 8 - with inputs.self.modules.nixos; 8 + with inputs.self.nixosModules; 9 9 with inputs.self.factory; 10 10 [ 11 11 grub
+1 -1
modules/hosts/loki/configuration.nix
··· 7 7 modules = [ 8 8 ({ pkgs, ... }: { 9 9 imports = 10 - with inputs.self.modules.nixos; 10 + with inputs.self.nixosModules; 11 11 with inputs.self.factory; 12 12 [ 13 13 systemd-boot
+1 -1
modules/hosts/njord/configuration.nix
··· 4 4 system = "aarch64-darwin"; 5 5 modules = [ 6 6 ({ ... }: { 7 - imports = with inputs.self.modules.darwin; [ 7 + imports = with inputs.self.darwinModules; [ 8 8 cosmeak 9 9 ]; 10 10
+1 -1
modules/hosts/sunna/configuration.nix
··· 4 4 system = "x86_64-linux"; 5 5 modules = [ 6 6 ({ ... }: { 7 - imports = with inputs.self.modules.nixos; [ 7 + imports = with inputs.self.nixosModules; [ 8 8 systemd-boot 9 9 nvidia-gpu 10 10 kde-desktop
+4 -4
modules/lib/host.nix
··· 6 6 modules = 7 7 modules ++ [ 8 8 hardwareConfig 9 - inputs.self.modules.nixos.unfree-packages 10 - inputs.self.modules.nixos.garbageCollector 9 + inputs.self.nixosModules.unfree-packages 10 + inputs.self.nixosModules.garbageCollector 11 11 ({ ... }: { 12 12 networking.hostName = hostname; 13 13 nix.settings.experimental-features = [ "nix-command" "flakes" ]; ··· 27 27 inputs.darwin.lib.darwinSystem { 28 28 inherit system; 29 29 modules = [ 30 - inputs.self.modules.darwin.unfree-packages 31 - inputs.self.modules.darwin.garbageCollector 30 + inputs.self.darwinModules.unfree-packages 31 + inputs.self.darwinModules.garbageCollector 32 32 ({ ... }: { 33 33 nix.enable = true; 34 34 networking.hostName = hostname;
+2 -2
modules/lib/user.nix
··· 1 1 { self, ... }: { 2 2 config.flake.factory.user = { username, isAdmin }: { 3 - nixos.${username} = { lib, pkgs, ... }: 3 + nixosModules.${username} = { lib, pkgs, ... }: 4 4 let home = "/home/${username}"; in { 5 5 # imports = [ self.modules.nixos.hjem ]; 6 6 ··· 17 17 # }; 18 18 }; 19 19 20 - darwin.${username} = { lib, pkgs, ... }: 20 + darwinModules.${username} = { lib, pkgs, ... }: 21 21 let home = "/Users/${username}"; in { 22 22 # imports = [ self.modules.darwin.hjem ]; 23 23
+10 -10
modules/tools/_hjem.nix modules/tools/hjem.nix
··· 1 1 { inputs, lib, ... }: 2 2 let 3 3 configuration = { 4 - # hjem.extraModules = [ inputs.self.modules.hjem ]; 4 + hjem.extraModules = [ inputs.self.hjemModules ]; 5 5 hjem.clobberByDefault = true; 6 6 }; 7 7 in 8 8 { 9 - flake.modules.nixos.hjem = { 10 - imports = [ inputs.hjem.nixosModules.default configuration ]; 11 - }; 12 - 13 - flake.modules.darwin.hjem = { 14 - imports = [ inputs.hjem.darwinModules.default configuration ]; 15 - }; 16 - 17 9 options.flake.hjemModules = lib.mkOption { 18 - type = lib.types.lazyAttrsOf lib.types.module; 10 + type = lib.types.lazyAttrsOf lib.types.deferredModule; 19 11 default = { }; 20 12 description = '' 21 13 Collection of modules defined in classic nix to extend hjem in the end. 22 14 ''; 15 + }; 16 + 17 + config.flake.nixosModules.hjem = { 18 + imports = [ inputs.hjem.nixosModules.default configuration ]; 19 + }; 20 + 21 + config.flake.darwinModules.hjem = { 22 + imports = [ inputs.hjem.darwinModules.default configuration ]; 23 23 }; 24 24 }
+34
modules/tools/darwin.nix
··· 1 + # Currently, there's no nix-darwin module for flake-parts, 2 + # so we have to manually add flake.darwinConfigurations 3 + # and the module options. 4 + { lib, moduleLocation, ... }: 5 + let 6 + inherit (lib) 7 + mapAttrs 8 + mkOption 9 + types 10 + ; 11 + in 12 + { 13 + options.flake.darwinConfigurations = lib.mkOption { 14 + type = lib.types.lazyAttrsOf lib.types.raw; 15 + default = { }; 16 + description = '' 17 + Instantiated Darwin configurations. Used by `darwin-rebuild`. 18 + ''; 19 + }; 20 + 21 + options.flake.darwinModules = mkOption { 22 + type = types.lazyAttrsOf types.deferredModule; 23 + default = { }; 24 + apply = mapAttrs (k: v: { 25 + _file = "${toString moduleLocation}#darwinModules.${k}"; 26 + imports = [ v ]; 27 + }); 28 + description = '' 29 + nix-darwin modules. 30 + 31 + You may use this for reusable pieces of configuration, service modules, etc. 32 + ''; 33 + }; 34 + }
-10
modules/tools/flake-parts.nix
··· 1 1 { lib, ... }: { 2 - # currently, there's no nix-darwin module for flake-parts, 3 - # so we have to manually add flake.darwinConfigurations 4 - options.flake.darwinConfigurations = lib.mkOption { 5 - type = lib.types.lazyAttrsOf lib.types.raw; 6 - default = { }; 7 - description = '' 8 - Instantiated Darwin configurations. Used by `darwin-rebuild`. 9 - ''; 10 - }; 11 - 12 2 # factory: storage for factory aspect functions 13 3 options.flake.factory = lib.mkOption { 14 4 type = lib.types.attrsOf lib.types.unspecified;
+20 -13
modules/users/cosmeak.nix
··· 16 16 starship # Customizable shell prompt 17 17 zoxide # Faster replacement of the `cd` cmd 18 18 ]; 19 + 20 + # Call the factory OUTSIDE of flake options 21 + factoryOutput = self.factory.user { 22 + username = username; 23 + isAdmin = true; 24 + }; 19 25 in 20 26 { 21 27 allowedUnfreePackages = [ "1password" "cursor" "obsidian" "raycast" "spotify" ]; 22 28 23 - flake.modules = lib.mkMerge [ 24 - (self.factory.user { 25 - username = username; 26 - isAdmin = true; 27 - }) 28 - { 29 - nixos.${username} = { pkgs, ... }: { 29 + flake = { 30 + nixosModules.${username} = lib.mkMerge [ 31 + (factoryOutput.nixosModules.${username} or {}) 32 + ({ pkgs, ... }: { 30 33 users.users.${username} = { 31 34 packages = with pkgs; [ 32 35 ghostty # Terminal emulator 33 36 heroic # Game Launcher (Epic Games, GOG) 37 + krita # Photo editor 34 38 obs-studio # Recording App 35 39 prismlauncher # Minecraft launcher 36 40 vesktop # Discord client 37 41 (zed-editor.fhsWithPackages (pkg: [ zlib ])) # Code editor 38 42 ] ++ (sharedPackages pkgs); 39 43 }; 40 - }; 44 + }) 45 + ]; 41 46 42 - darwin.${username} = { pkgs, ... }: { 47 + darwinModules.${username} = lib.mkMerge [ 48 + (factoryOutput.darwinModules.${username} or {}) 49 + ({ pkgs, ... }: { 43 50 environment.systemPackages = with pkgs; [ 44 51 alt-tab-macos # alt tab like windows on macos 45 52 bruno # IDE for testing apis ··· 51 58 podman # container tool -> replacement of docker 52 59 podman-compose # compose provider for podman 53 60 raycast # replacement for spotlight 54 - ]++ (sharedPackages pkgs); 55 - }; 56 - } 57 - ]; 61 + ] ++ (sharedPackages pkgs); 62 + }) 63 + ]; 64 + }; 58 65 }
+1 -1
modules/users/neoxa.nix
··· 5 5 { 6 6 allowedUnfreePackages = [ "corefonts" "davinci-resolve" "steam" "steam-unwrapped" "spotify" "unityhub" ]; 7 7 8 - flake.modules.nixos.${username} = { pkgs, ... }: { 8 + flake.nixosModules.${username} = { pkgs, ... }: { 9 9 users.users.${username} = { 10 10 isNormalUser = true; 11 11 extraGroups = [ "networkmanager" "wheel" ];