Nix Flakes configuration for MacOS, NixOS and WSL
0
fork

Configure Feed

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

wip: custom lib

+167 -111
archives/beowulf/default.nix hosts/x86_64-linux/beowulf/default.nix
+15 -19
archives/nyx/default.nix hosts/x86_64-linux/nyx/default.nix
··· 1 - { lib, pkgs, inputs, namespace, system, target, format, virtual, systems, config, ... }: 1 + { self, inputs, pkgs, config, ... }: 2 2 with lib; 3 3 with lib.${namespace}; 4 4 { 5 - imports = [ 6 - ./hardware.nix 7 - inputs.home-manager.nixosModules.home-manager 8 - inputs.microvm.nixosModules.host 9 - ]; 5 + imports = [ ./hardware.nix ]; 10 6 11 - asgard = { 12 - system = { 13 - bootloader.enable = true; 14 - }; 7 + # asgard = { 8 + # system = { 9 + # bootloader.enable = true; 10 + # }; 15 11 16 - hardware = { 17 - gpu.nvidia.enable = true; 18 - audio.enable = true; 19 - }; 12 + # hardware = { 13 + # gpu.nvidia.enable = true; 14 + # audio.enable = true; 15 + # }; 20 16 21 - desktop.budgie.enable = true; 17 + # desktop.budgie.enable = true; 22 18 23 - apps = { 24 - steam.enable = true; 25 - }; 26 - }; 19 + # apps = { 20 + # steam.enable = true; 21 + # }; 22 + # }; 27 23 28 24 networking.hostName = "nyx"; # Define your hostname. 29 25 # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
archives/nyx/hardware.nix hosts/x86_64-linux/nyx/hardware.nix
+3 -10
archives/vali/configuration.nix hosts/x86_64-linux/vali/default.nix
··· 1 - # Edit this configuration file to define what should be installed on 2 - # your system. Help is available in the configuration.nix(5) man page, on 3 - # https://search.nixos.org/options and in the NixOS manual (`nixos-help`). 4 - 5 1 # NixOS-WSL specific options are documented on the NixOS-WSL repository: 6 2 # https://github.com/nix-community/NixOS-WSL 7 - 8 3 { config, lib, pkgs, ... }: 9 - 10 4 { 11 5 imports = [ 12 6 inputs.wsl.nixosModules.wsl 13 - inputs.home-manager.nixosModules.home-manager 14 7 ]; 15 8 16 9 wsl.enable = true; 17 10 wsl.defaultUser = "vali"; 18 - 19 - environment.systemPackages = with pkgs; [ 11 + 12 + environment.systemPackages = with pkgs; [ 20 13 wget 21 14 git 22 15 lazygit 23 16 php83 24 17 php83Packages.composer 25 - nodejs_20 18 + nodejs_20 26 19 ]; 27 20 28 21 # This value determines the NixOS release from which the default
+7 -39
flake.nix
··· 16 16 17 17 home-manager.url = "github:nix-community/home-manager/release-24.11"; 18 18 home-manager.inputs.nixpkgs.follows = "nixpkgs"; 19 - 19 + 20 20 zen-browser.url = "github:0xc000022070/zen-browser-flake"; 21 21 }; 22 - 23 - outputs = { self, nixpkgs, darwin, ... }@inputs: 24 - let inherit (self) outputs; lib = import ./lib { inherit self inputs; }; in 25 - { 26 - overlays = import ./overlays { inherit inputs outputs; }; 27 22 28 - nixosConfigurations = { 29 - # loki = nixpkgs.lib.nixosSystem { 30 - # system = "x86_64-linux"; 31 - # specialArgs = { inherit inputs self; }; 32 - # modules = [ ./hosts/x86_64-linux/loki ]; 33 - # }; 34 - 35 - # TODO: rework configuration not being usable at the moment 36 - # nyx = nixpkgs.lib.nixosSystem { 37 - # specialArgs = { inherit inputs; }; 38 - # modules = [ ./hosts/x86_64-linux/nyx ]; 39 - # }; 40 - 41 - # vali = nixpkgs.lib.nixosSystem { 42 - # system = "x86_64-linux"; 43 - # specialArgs = { inherit inputs; }; 44 - # modules = [ ./hosts/x86_64-linux/vali ]; 45 - # }; 23 + outputs = { self, nixpkgs, darwin, ... }@inputs: 24 + let inherit (self) outputs; lib = import ./lib { inherit self inputs; }; in 25 + { overlays = import ./overlays { inherit inputs outputs; }; } 26 + // (lib.host.mkHosts); 46 27 47 - # Raspberry Pi 3b+ 48 - # narfi = nixpkgs.lib.nixosSystem { 49 - # specialArgs = { inherit inputs; }; 50 - # modules = [ ./hosts/aarch64-linux/nyx ]; 51 - # }; 52 - }; 53 - 54 - darwinConfigurations = { 55 - njord = darwin.lib.darwinSystem { 56 - system = "aarch64-darwin"; 57 - specialArgs = { inherit inputs; }; 58 - modules = [ ./hosts/aarch64-darwin/njord ]; 59 - }; 60 - }; 61 - } // (lib.host.mkHost { system = "x86_64-linux"; hostname = "loki"; path = ./hosts/x86_64-linux/loki/default.nix; }); 28 + # // (lib.host.mkHost { system = "x86_64-linux"; hostname = "loki"; path = ./hosts/x86_64-linux/loki/default.nix; }) 29 + # // (lib.host.mkHost { system = "aarch64-darwin"; hostname = "njord"; path = ./hosts/aarch64-darwin/njord/default.nix; }); 62 30 }
+1 -1
homes/_shared/cosmeak/default.nix
··· 1 1 { inputs, pkgs, ...}: 2 2 { 3 - imports = [ ./neovim ]; 3 + imports = [ ./neovim ]; 4 4 5 5 home.packages = with pkgs; [ 6 6 bat
+3 -3
homes/aarch64-darwin/njord/cosmeak/default.nix
··· 1 1 { inputs, pkgs, ... }: 2 2 { 3 - imports = [ 3 + imports = [ 4 4 ./../../../_shared/cosmeak 5 5 ]; 6 6 ··· 13 13 php83 14 14 php83Packages.composer 15 15 nodejs_20 16 - python310 16 + python310 17 17 18 18 # CLI 19 19 tree ··· 28 28 29 29 # Window Manager 30 30 # Actually disabled because issue with french keyboard bindings 31 - # aerospace 31 + # aerospace 32 32 ]; 33 33 34 34 programs.kitty = {
+1 -1
homes/x86_64-linux/loki/cosmeak/default.nix
··· 6 6 7 7 home.packages = with pkgs; [ 8 8 btop 9 - discord 9 + discord 10 10 just 11 11 lazygit 12 12 lutris
+2 -2
hosts/aarch64-darwin/njord/default.nix
··· 27 27 28 28 # System wide packages 29 29 environment.systemPackages = with pkgs; [ 30 - # Add packages here 30 + just 31 31 ]; 32 32 33 33 # Garbage collector ··· 45 45 nixpkgs.config.allowUnfree = true; 46 46 47 47 # Enable flakes 48 - nix.settings.experimental-features = [ "nix-command" "flakes" ]; 48 + nix.settings.experimental-features = [ "nix-command" "flakes" "pipe-operators" ]; 49 49 50 50 # Use nix as a daemon 51 51 services.nix-daemon.enable = true;
+1
hosts/aarch64-darwin/njord/homebrew/casks.nix
··· 16 16 "thunderbird" # install via nix if possiblex 17 17 "obsidian" 18 18 "brave-browser" 19 + "1password" 19 20 20 21 # Mics 21 22 "amethyst" # Window manager
+3 -3
hosts/aarch64-darwin/njord/system/nsglobaldomain.nix
··· 5 5 # Disable saving new documents to icloud 6 6 NSDocumentSaveNewDocumentsToCloud = false; 7 7 # Time before the key is repeated 8 - InitialKeyRepeat = 7; 8 + # InitialKeyRepeat = 7; 9 9 # Time between repeat key 10 - KeyRepeat = 6; 10 + # KeyRepeat = 6; 11 11 # Window open animation 12 12 NSAutomaticWindowAnimationsEnabled = false; 13 13 # Icon size in finder ··· 19 19 # Natural scrolling direction 20 20 "com.apple.swipescrolldirection" = true; 21 21 }; 22 - } 22 + }
+5 -9
hosts/x86_64-linux/loki/default.nix
··· 1 1 { self, inputs, pkgs, config, ... }: 2 2 { 3 - imports = [ 3 + imports = [ 4 4 ./hardware.nix 5 5 # ./../../../modules/nixos/services/window-managers/river 6 6 inputs.home-manager.nixosModules.home-manager 7 7 ]; 8 8 9 9 # Window manager 10 - services.windowManager.river.enable = true; 10 + asgard.programs.windowManager.river.enable = true; 11 11 12 12 # Home Manager 13 13 home-manager.useGlobalPkgs = true; ··· 110 110 protonup 111 111 vlc 112 112 pavucontrol 113 - 113 + 114 114 inputs.zen-browser.packages."${system}".default 115 115 116 116 # For gaming purposes ··· 124 124 mode = "0755"; 125 125 }; 126 126 127 - # Define a user account. Don't forget to set a password with ‘passwd’. 128 - users.users.cosmeak = { 129 - isNormalUser = true; 130 - description = "cosmeak"; 131 - extraGroups = [ "networkmanager" "wheel" ]; 132 - }; 127 + # Add extra groups to users 128 + users.users.cosmeak.extraGroups = [ "networkmanager" "wheel" ]; 133 129 134 130 # Enable or not CUPS to print documents. 135 131 services.printing.enable = false;
+62 -18
lib/default.nix
··· 1 1 { self, inputs, ... }: 2 - let inherit (inputs.nixpkgs) lib; in 2 + let inherit (inputs.nixpkgs) lib; in 3 3 rec { 4 4 ## FileSystem 5 5 ## Help manage file and access to it 6 6 fs = rec { 7 - ## Match if type is a directory 7 + ## Match if type is a directory 8 8 #@ String -> Boolean 9 9 isDirectory = type: type == "directory"; 10 10 11 - ## Match if type is a file 11 + ## Match if type is a file 12 12 #@ String -> Boolean 13 13 isFile = type: type == "regular"; 14 14 15 15 ## Get directories at a given path 16 16 #@ Path -> []Path 17 - getDirectories = path: 17 + getDirectories = path: 18 18 builtins.readDir path 19 19 |> lib.filterAttrs (_: type: type |> isDirectory) 20 20 |> lib.mapAttrsToList(name: _: "${path}/${name}"); ··· 28 28 29 29 ## Get files in all folders at a giver path 30 30 #@ Path -> []Path 31 - getFilesRecursively = path: let 31 + getFilesRecursively = path: let 32 32 entries = builtins.readDir path |> lib.filterAttrs (name: type: (type |> isDirectory) || (type |> isFile)); 33 33 mapFile = name: type: let 34 34 path' = "${path}/${name}"; 35 - in 35 + in 36 36 if type |> isDirectory 37 37 then getFilesRecursively path' 38 38 else path'; 39 39 files = lib.flatten (lib.mapAttrsToList mapFile entries); 40 40 in files; 41 - 41 + 42 42 ## Get the default file in the directory if exists 43 43 #@ Path -> Path|null 44 44 getDefaultFile = path: let path = "${path}/default.nix"; in if builtins.pathExists path then path else null; ··· 70 70 #@ String -> Bool 71 71 isDarwin = lib.hasInfix "darwin"; 72 72 73 - ## Get structured data about all hosts for a system 73 + ## Get structured data about all hosts for a system 74 74 #@ String -> [Attrs] 75 - getSystemHostsInformations = systemPath: let 75 + getSystemHostsInformations = systemPath: let 76 76 hosts = fs.getDirectories systemPath; 77 77 mkHostInformations = path: { 78 78 system = builtins.baseNameOf systemPath; 79 79 hostname = builtins.baseNameOf path; 80 80 path = fs.getDefaultFile path; 81 81 }; 82 - hostsInformations = builtins.map hosts; 82 + hostsInformations = builtins.map mkHostInformations hosts; 83 83 in hostsInformations; 84 84 85 85 ## Get the name of the system output 86 86 #@ String -> String 87 - getHostSystemOutput = system: if system |> isDarwin then "darwinConfigurations" else "nixosConfigurations"; 87 + getOutput = system: if system |> isDarwin then "darwinConfigurations" else "nixosConfigurations"; 88 88 89 89 ## Get the system host builder 90 90 #@ String -> Functions 91 - getHostBuilder = system: let 91 + getBuilder = system: let 92 92 linuxBuilder = args: lib.nixosSystem (args // { 93 93 modules = args.modules ++ module.getNixosModules; 94 94 }); ··· 106 106 system, 107 107 hostname, 108 108 path, 109 - builder ? getHostBuilder system, 110 - output ? getHostSystemOutput system 109 + builder ? getBuilder system, 110 + output ? getOutput system 111 111 }: { 112 112 ${output}.${hostname} = builder { 113 113 system = system; ··· 118 118 119 119 ## Create all available hosts 120 120 #@ Attrs -> Attrs 121 - mkHosts = let 121 + mkHosts = let 122 122 systems = fs.getDirectories ./../hosts; 123 - hostsInformations = lib.concatMap getSystemHostsInformations systems; 124 - in { 123 + hostsInformations = lib.concatMap (systemPath: getSystemHostsInformations systemPath) systems; 124 + generateHosts = infos: lib.foldl (acc: info: acc // host.mkHost info) {} infos; 125 + in generateHosts hostsInformations; 126 + }; 127 + 128 + ## Home 129 + ## Help me manage creation of all users home by host 130 + home = rec { 131 + ## Create home modules for a user 132 + #@ Attrs -> []Module 133 + mkHome = { 134 + system, 135 + hostname, 136 + username, 137 + stateVersion ? "24.11" 138 + }: 139 + [ 140 + (if system |> host.isDarwin then inputs.home-manager.darwinModules.home-manager else inputs.home-manager.nixosModules.home-manager) 141 + { 142 + inputs.home-manager.useGlobalPkgs = true; 143 + inputs.home-manager.useUserPackages = true; 144 + inputs.home-manager.extraSpecialArgs = { inherit system hostname username; }; 145 + inputs.home-manager.${username} = { 146 + imports = [ ./homes/${system}/${hostname}/${username}/default.nix ] ++ module.getHomeManagerModules; 147 + programs.home-manager.enable = true; # Let home manager manage itself 148 + home.username = username; 149 + home.homeDirectory = if system |> host.isDarwin then "/Users/${username}" else "/home/${username}"; 150 + home.stateVersion = stateVersion; 151 + }; 152 + } 153 + (if system |> host.isLinux then { 154 + # Define a user account. Don't forget to set a password with ‘passwd’. 155 + users.users.${username} = { 156 + isNormalUser = true; 157 + description = username; 158 + extraGroups = [ ]; 159 + }; 160 + } else {}) 161 + ]; 162 + 163 + ## Create all user home from a host 164 + #@ Attrs -> []Modules 165 + mkHomes = { 166 + system, 167 + host 168 + }: { 125 169 126 170 }; 127 171 }; ··· 132 176 ## Build flake output 133 177 mkFlake = {}; 134 178 }; 135 - } 179 + }
modules/darwin/.gitkeep

This is a binary file and will not be displayed.

+13
modules/darwin/programs/window-managers/amethyst/default.nix
··· 1 + { lib, pkgs, config, ... }: 2 + let 3 + cfg = config.asgard.programs.windowManager.amethyst; 4 + in 5 + { 6 + options.asgard.programs.windowManager.amethyst = { 7 + enable = lib.mkEnableOption "Amethyst - Aqua (MacOS) Window Manager"; 8 + }; 9 + 10 + config = lib.mkIf cfg.enable ({ 11 + homebrew.casks = [ "amethyst" ]; 12 + }); 13 + }
modules/home-manager/.gitkeep

This is a binary file and will not be displayed.

+45
modules/home-manager/programs/window-managers/amethyst/default.nix
··· 1 + { lib, pkgs, config, ... }: 2 + let 3 + cfg = config.asgard.programs.windowManager.amethyst; 4 + yamlFormat = pkgs.formats.yaml { }; 5 + in 6 + { 7 + options.asgard.programs.windowManager.amethyst = { 8 + settings = lib.mkOption { 9 + type = yamlFormat.type; 10 + default = { 11 + layouts = [ 12 + "tall" 13 + "wide" 14 + "column" 15 + ]; 16 + 17 + window-margins = true; 18 + window-margin-size = 16; 19 + window-max-count = 3; 20 + 21 + hide-menu-bar-icon = true; 22 + 23 + mod1 = [ 24 + "command" 25 + "shift" 26 + ]; 27 + 28 + mod2 = [ 29 + "command" 30 + "shift" 31 + "option" 32 + ]; 33 + }; 34 + description = '' 35 + Configuration written to {file}`$XDG_CONFIG_HOME/amethyst/amethyst.yml`. 36 + '' 37 + }; 38 + }; 39 + 40 + config = lib.mkIf (cfg.settings != {}) ({ 41 + home.file."amethyst/amethyst.yml" = { 42 + source = yamlFormat.generate "amethyst.yml" cfg.settings; 43 + }; 44 + }); 45 + }
+3 -3
modules/nixos/services/window-managers/dwl/default.nix modules/nixos/programs/window-managers/dwl/default.nix
··· 1 1 { config, lib, pkgs, ... }: 2 - let cfg = config.services.windowManager.dwl; in 2 + let cfg = config.asgard.programs.windowManager.dwl; in 3 3 { 4 - options.services.windowManager.dwl = { 4 + options.asgard.programs.windowManager.dwl = { 5 5 enable = lib.mkEnableOption "DWL Window Manager"; 6 6 7 7 xwayland.enable = lib.mkEnableOption "XWayland" // { 8 8 default = true; 9 9 }; 10 10 11 - # Move dwl overlay here to give access to override patches 11 + # Move dwl overlay here to give access to override patches 12 12 # packages = lib.mkPackageOption pkgs "dwl" { 13 13 14 14 # };
+3 -3
modules/nixos/services/window-managers/river/default.nix modules/nixos/programs/window-managers/river/default.nix
··· 1 1 { config, lib, pkgs, ... }: 2 - let cfg = config.services.windowManager.river; in 2 + let cfg = config.asgard.programs.windowManager.river; in 3 3 { 4 - options.services.windowManager.river = { 4 + options.asgard.programs.windowManager.river = { 5 5 enable = lib.mkEnableOption "River - A Wayland Window Manager"; 6 6 extraPackages = lib.mkOption { 7 7 type = with lib.types; listOf package; ··· 34 34 river 35 35 ''; 36 36 }); 37 - } 37 + }