From 4aab3491588053527332dc8cbc536b80b9c29439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Czy=C5=BC?= Date: Sun, 5 Jan 2025 19:49:53 +0100 Subject: [PATCH] BREAKING-CHANGE: modified structure, hm is now standalone --- flake.lock | 191 +++++++++----- flake.nix | 79 ++++-- home-manager/home.nix | 235 +++++++++++++----- home-manager/programs/packages.nix | 2 +- home-manager/system/stylix.nix | 6 +- hosts/default.nix | 82 ------ hosts/modules/boot.nix | 15 +- .../modules/{configuration.nix => common.nix} | 42 +++- hosts/modules/development.nix | 3 +- hosts/modules/gaming.nix | 8 +- hosts/modules/network.nix | 3 +- hosts/modules/nh.nix | 4 +- hosts/modules/users.nix | 38 ++- hosts/modules/vm.nix | 7 +- hosts/server/configuration.nix | 43 ++++ hosts/thor/configuration.nix | 56 +++++ .../hardware-configuration.nix} | 0 hosts/zion/configuration.nix | 57 +++++ .../hardware-configuration.nix} | 0 modules/home-manager/default.nix | 6 + modules/nixos/default.nix | 6 + overlays/default.nix | 20 +- pkgs/default.nix | 5 + 23 files changed, 586 insertions(+), 322 deletions(-) delete mode 100644 hosts/default.nix rename hosts/modules/{configuration.nix => common.nix} (66%) create mode 100644 hosts/server/configuration.nix create mode 100644 hosts/thor/configuration.nix rename hosts/{thor.nix => thor/hardware-configuration.nix} (100%) create mode 100644 hosts/zion/configuration.nix rename hosts/{zion.nix => zion/hardware-configuration.nix} (100%) create mode 100644 modules/home-manager/default.nix create mode 100644 modules/nixos/default.nix create mode 100644 pkgs/default.nix diff --git a/flake.lock b/flake.lock index a743215..54506b4 100644 --- a/flake.lock +++ b/flake.lock @@ -107,11 +107,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1735566338, - "narHash": "sha256-9sYGJZCGeb11WBVsE2u0gwuTk8LpbOgnrJvyDbHpOoY=", + "lastModified": 1735943654, + "narHash": "sha256-rXmcRRQfXXYAKOa5IXlrMISTwgScA2Dx04JpONXRA+Q=", "owner": "chaotic-cx", "repo": "nyx", - "rev": "446ad45313df3dbc93ad9e9d8dd6d094b16f6fb4", + "rev": "5edcf7fb24c73ff9665f299461af33fa6171836f", "type": "github" }, "original": { @@ -368,6 +368,37 @@ "type": "github" } }, + "git-hooks": { + "inputs": { + "flake-compat": [ + "stylix", + "flake-compat" + ], + "gitignore": "gitignore_2", + "nixpkgs": [ + "stylix", + "nixpkgs" + ], + "nixpkgs-stable": [ + "stylix", + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1731363552, + "narHash": "sha256-vFta1uHnD29VUY4HJOO/D6p6rxyObnf+InnSMT4jlMU=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "cd1af27aa85026ac759d5d3fccf650abe7e1bbf0", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, "gitignore": { "inputs": { "nixpkgs": [ @@ -390,6 +421,28 @@ "type": "github" } }, + "gitignore_2": { + "inputs": { + "nixpkgs": [ + "stylix", + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "gnome-shell": { "flake": false, "locked": { @@ -415,11 +468,11 @@ ] }, "locked": { - "lastModified": 1734622215, - "narHash": "sha256-OOfI0XhSJGHblfdNDhfnn8QnZxng63rWk9eeJ2tCbiI=", + "lastModified": 1735774425, + "narHash": "sha256-C73gLFnEh8ZI0uDijUgCDWCd21T6I6tsaWgIBHcfAXg=", "owner": "nix-community", "repo": "home-manager", - "rev": "1395379a7a36e40f2a76e7b9936cc52950baa1be", + "rev": "5f6aa268e419d053c3d5025da740e390b12ac936", "type": "github" }, "original": { @@ -435,15 +488,16 @@ ] }, "locked": { - "lastModified": 1735381016, - "narHash": "sha256-CyCZFhMUkuYbSD6bxB/r43EdmDE7hYeZZPTCv0GudO4=", + "lastModified": 1735344290, + "narHash": "sha256-oJDtWPH1oJT34RJK1FSWjwX4qcGOBRkcNQPD0EbSfNM=", "owner": "nix-community", "repo": "home-manager", - "rev": "10e99c43cdf4a0713b4e81d90691d22c6a58bdf2", + "rev": "613691f285dad87694c2ba1c9e6298d04736292d", "type": "github" }, "original": { "owner": "nix-community", + "ref": "release-24.11", "repo": "home-manager", "type": "github" } @@ -456,11 +510,11 @@ ] }, "locked": { - "lastModified": 1733085484, - "narHash": "sha256-dVmNuUajnU18oHzBQWZm1BQtANCHaqNuxTHZQ+GN0r8=", + "lastModified": 1735774425, + "narHash": "sha256-C73gLFnEh8ZI0uDijUgCDWCd21T6I6tsaWgIBHcfAXg=", "owner": "nix-community", "repo": "home-manager", - "rev": "c1fee8d4a60b89cae12b288ba9dbc608ff298163", + "rev": "5f6aa268e419d053c3d5025da740e390b12ac936", "type": "github" }, "original": { @@ -543,11 +597,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1735585949, - "narHash": "sha256-vCGG4tGMvzCzz+ZIsiNtpoFW9+f+itYLTAVW41qk/Hk=", + "lastModified": 1736008833, + "narHash": "sha256-3OvlurfefGSjT4E+qRvQNmqqRVlbHN8ifZy5C3uUZM8=", "ref": "refs/heads/main", - "rev": "1989b0049f7fb714a2417dfb14d6b4f3d2a079d3", - "revCount": 5607, + "rev": "b0bae15499ad57bbfeae8be958df8c022201e583", + "revCount": 5628, "submodules": true, "type": "git", "url": "https://github.com/hyprwm/Hyprland" @@ -575,11 +629,11 @@ ] }, "locked": { - "lastModified": 1735295819, - "narHash": "sha256-iHDDF1kj+wX7fHGTgKaM6rli6+O8mVFNmpypo+SgnNs=", + "lastModified": 1735838245, + "narHash": "sha256-dA2s+KFo6+TmYtQoXWfxQ8XukN6JQ0I0VoraG9zD7/I=", "owner": "hyprwm", "repo": "hyprland-plugins", - "rev": "a41bcdccac7d3fe220b3a8519633f0a812da3439", + "rev": "920af33577a889772e96a067130252df5674ca8a", "type": "github" }, "original": { @@ -600,11 +654,11 @@ ] }, "locked": { - "lastModified": 1728345020, - "narHash": "sha256-xGbkc7U/Roe0/Cv3iKlzijIaFBNguasI31ynL2IlEoM=", + "lastModified": 1735734474, + "narHash": "sha256-9OV4lOqrEJVLdOrpNN/9msNwAhI6FQTu4N7fufilG08=", "owner": "hyprwm", "repo": "hyprland-protocols", - "rev": "a7c183800e74f337753de186522b9017a07a8cee", + "rev": "271df559dd30e4bc5ec6af02d017ac0aaabd63a7", "type": "github" }, "original": { @@ -703,11 +757,11 @@ "systems": "systems_2" }, "locked": { - "lastModified": 1734125519, - "narHash": "sha256-dK1Dozb/tI8Dyg9aBBUgNt7L/HTTxB807Kfoh/PWSCw=", + "lastModified": 1735946714, + "narHash": "sha256-1kcSHRLdp9wEZdrdfh4h3VNzHIupON9gf4FtqMz4+54=", "owner": "hyprwm", "repo": "hyprpolkitagent", - "rev": "ae7c5be24c63b8a53d0d5f5344d821b5f48d3623", + "rev": "08cab3a4d9277687562702ae2db56305f9165081", "type": "github" }, "original": { @@ -745,11 +799,11 @@ "systems": "systems_4" }, "locked": { - "lastModified": 1729184813, - "narHash": "sha256-ARrsIQPFCHWjVl9Sxh8tedIoEsvnV4nORaDmYCyK+kk=", + "lastModified": 1735826012, + "narHash": "sha256-F/Yfn43SisTV2AUErkXToaFCOwryMcmaiz4Tw3VSpSk=", "owner": "hyprwm", "repo": "hyprsysteminfo", - "rev": "8b271e2ba39a5a9299e4e7bb60245a71704f5a89", + "rev": "3498fad4c4b9c161fd78896ef583f492c93c7859", "type": "github" }, "original": { @@ -1055,11 +1109,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1735471104, - "narHash": "sha256-0q9NGQySwDQc7RhAV2ukfnu7Gxa5/ybJ2ANT8DQrQrs=", + "lastModified": 1735834308, + "narHash": "sha256-dklw3AXr3OGO4/XT1Tu3Xz9n/we8GctZZ75ZWVqAVhk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "88195a94f390381c6afcdaa933c2f6ff93959cb4", + "rev": "6df24922a1400241dae323af55f30e4318a6ca65", "type": "github" }, "original": { @@ -1085,6 +1139,21 @@ "type": "github" } }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1735834308, + "narHash": "sha256-dklw3AXr3OGO4/XT1Tu3Xz9n/we8GctZZ75ZWVqAVhk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6df24922a1400241dae323af55f30e4318a6ca65", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, "nixpkgs_10": { "locked": { "lastModified": 1731139594, @@ -1183,11 +1252,11 @@ }, "nixpkgs_7": { "locked": { - "lastModified": 1735531152, - "narHash": "sha256-As8I+ebItDKtboWgDXYZSIjGlKeqiLBvjxsQHUmAf1Q=", + "lastModified": 1735922141, + "narHash": "sha256-vk0xwGZSlvZ/596yxOtsk4gxsIx2VemzdjiU8zhjgWw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3ffbbdbac0566a0977da3d2657b89cbcfe9a173b", + "rev": "d29ab98cd4a70a387b8ceea3e930b3340d41ac5a", "type": "github" }, "original": { @@ -1198,11 +1267,11 @@ }, "nixpkgs_8": { "locked": { - "lastModified": 1735471104, - "narHash": "sha256-0q9NGQySwDQc7RhAV2ukfnu7Gxa5/ybJ2ANT8DQrQrs=", + "lastModified": 1735834308, + "narHash": "sha256-dklw3AXr3OGO4/XT1Tu3Xz9n/we8GctZZ75ZWVqAVhk=", "owner": "nixos", "repo": "nixpkgs", - "rev": "88195a94f390381c6afcdaa933c2f6ff93959cb4", + "rev": "6df24922a1400241dae323af55f30e4318a6ca65", "type": "github" }, "original": { @@ -1235,11 +1304,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1735648437, - "narHash": "sha256-cVc5Bn/oznCvRFDpCZEpQVo3FmpgQKGZEZ5RW4xvRu8=", + "lastModified": 1736095314, + "narHash": "sha256-HEGbYi2QfGTcy2TsEy1gDsbXuA/IaN5d5IZj2XJfAys=", "owner": "nix-community", "repo": "NUR", - "rev": "1bb7310d7d1eeaa33d1d009ac493bc2b38acef40", + "rev": "cef9be6b71dfda87045ee9a83be7fb96ee545133", "type": "github" }, "original": { @@ -1284,13 +1353,13 @@ "lanzaboote": "lanzaboote", "nix-alien": "nix-alien", "nixpkgs": "nixpkgs_7", + "nixpkgs-unstable": "nixpkgs-unstable", "nur": "nur", "rosepine-kvantum": "rosepine-kvantum", "rust-overlay": "rust-overlay_2", "spicetify-nix": "spicetify-nix", "split-monitor-workspaces": "split-monitor-workspaces", "stylix": "stylix", - "unstable": "unstable", "zen-browser": "zen-browser" } }, @@ -1345,11 +1414,11 @@ ] }, "locked": { - "lastModified": 1735612067, - "narHash": "sha256-rsjojgfPUf9tWuMXuuo2KAIoUZ49XGZQJSjFGOO8Cq4=", + "lastModified": 1736044260, + "narHash": "sha256-DTAr0mAd8AZwWgRtU9ZZFPz3DwNeoH/Oi/1QMSqc9YQ=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "d199142e84bfaae476ffb4e09a70879d7918784d", + "rev": "c8ed24cc104ebbc218d992e208131e9f024b69f0", "type": "github" }, "original": { @@ -1366,11 +1435,11 @@ ] }, "locked": { - "lastModified": 1735618543, - "narHash": "sha256-Aqhp0PcsoEn4FRWZYJZHbHeB+FOJDQcbsaEsXv0iA9k=", + "lastModified": 1736050526, + "narHash": "sha256-wscvKDsyIES59ltENnOw7Hz8WKU8hg5m7dYbcJN2u6A=", "owner": "Gerg-L", "repo": "spicetify-nix", - "rev": "2da20133b52ac69a1f348c08dc801c8638261548", + "rev": "78c9ace8b9e1d7b64b4d797a066047c2332d24f6", "type": "github" }, "original": { @@ -1387,11 +1456,11 @@ "nix-filter": "nix-filter_2" }, "locked": { - "lastModified": 1734644214, - "narHash": "sha256-alZJZJn5cmxNGtKZcsKzOnnTtYpcvZjqSZ48Ep7ST5Q=", + "lastModified": 1735854954, + "narHash": "sha256-jW65EsiA0oxt7ZilCMXU8xRSaHxEaXdin9vc/9OX4U0=", "owner": "Duckonaut", "repo": "split-monitor-workspaces", - "rev": "88dffb38b01c712f80fe431f73859cd2210e718d", + "rev": "c75ec3a643a98169acdea03336c06f3656fe0e76", "type": "github" }, "original": { @@ -1408,6 +1477,7 @@ "base16-vim": "base16-vim", "flake-compat": "flake-compat_5", "flake-utils": "flake-utils_4", + "git-hooks": "git-hooks", "gnome-shell": "gnome-shell", "home-manager": "home-manager_3", "nixpkgs": [ @@ -1419,11 +1489,11 @@ "tinted-tmux": "tinted-tmux" }, "locked": { - "lastModified": 1735524788, - "narHash": "sha256-R4i8VCdSGLWHt6cL5p2Cmlh9MRodZsYO8moUjvxYb54=", + "lastModified": 1736011580, + "narHash": "sha256-8gmk/i9ZA5C6LGRnqHb5sZ8UKaqT5GnS6XxeSPMSz+s=", "owner": "danth", "repo": "stylix", - "rev": "a4ed4168fb83289374f24cb8a039c6983637a076", + "rev": "7dfcdb410118dcd02ba1d85a2179a6f1c877403f", "type": "github" }, "original": { @@ -1623,21 +1693,6 @@ "type": "github" } }, - "unstable": { - "locked": { - "lastModified": 1735471104, - "narHash": "sha256-0q9NGQySwDQc7RhAV2ukfnu7Gxa5/ybJ2ANT8DQrQrs=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "88195a94f390381c6afcdaa933c2f6ff93959cb4", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixos-unstable", - "type": "indirect" - } - }, "xdph": { "inputs": { "hyprland-protocols": [ diff --git a/flake.nix b/flake.nix index 3ba22a9..c36c6e3 100644 --- a/flake.nix +++ b/flake.nix @@ -3,7 +3,7 @@ inputs = { nixpkgs.url = "nixpkgs/nixos-24.11"; - unstable.url = "nixpkgs/nixos-unstable"; + nixpkgs-unstable.url = "nixpkgs/nixos-unstable"; chaotic.url = "github:chaotic-cx/nyx/nyxpkgs-unstable"; nur.url = "github:nix-community/NUR"; nix-alien.url = "github:thiagokokada/nix-alien"; @@ -42,7 +42,7 @@ }; home-manager = { - url = "github:nix-community/home-manager"; + url = "github:nix-community/home-manager/release-24.11"; inputs.nixpkgs.follows = "nixpkgs"; }; @@ -60,7 +60,6 @@ outputs = { self, nixpkgs, - unstable, home-manager, ... } @ inputs: let @@ -75,42 +74,76 @@ in { # Your custom packages # Accessible through 'nix build', 'nix shell', etc - # packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); + packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); # Formatter for your nix files, available through 'nix fmt' # Other options beside 'alejandra' include 'nixpkgs-fmt' formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra); # Your custom packages and modifications, exported as overlays overlays = import ./overlays {inherit inputs;}; + # Reusable nixos modules you might want to export + # These are usually stuff you would upstream into nixpkgs + nixosModules = import ./modules/nixos; + # Reusable home-manager modules you might want to export + # These are usually stuff you would upstream into home-manager + homeManagerModules = import ./modules/home-manager; # NixOS configuration entrypoint - # Available through 'nixos-rebuild --flake .#hostname' + # Available through 'nixos-rebuild --flake .#your-hostname' nixosConfigurations = { zion = nixpkgs.lib.nixosSystem { - modules = [./hosts]; - specialArgs = { - inherit inputs outputs; - username = "mike"; - hostname = "zion"; - }; + specialArgs = {inherit inputs outputs;}; + modules = [ + # > Our main nixos configuration file < + ./hosts/zion/configuration.nix + ]; }; thor = nixpkgs.lib.nixosSystem { - modules = [./hosts]; - specialArgs = { - inherit inputs outputs; - username = "mike"; - hostname = "thor"; - }; + specialArgs = {inherit inputs outputs;}; + modules = [ + # > Our main nixos configuration file < + ./hosts/thor/configuration.nix + ]; }; server = nixpkgs.lib.nixosSystem { - modules = [./hosts]; - specialArgs = { - inherit inputs outputs; - username = "mike"; - hostname = "server"; - }; + specialArgs = {inherit inputs outputs;}; + modules = [ + # > Our main nixos configuration file < + ./hosts/server/configuration.nix + ]; + }; + }; + + # Standalone home-manager configuration entrypoint + # Available through 'home-manager --flake .#your-username@your-hostname' + homeConfigurations = { + "mike@zion" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance + extraSpecialArgs = {inherit inputs outputs;}; + modules = [ + # > Our main home-manager configuration file < + ./home-manager/home.nix + ]; + }; + + "mike@thor" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance + extraSpecialArgs = {inherit inputs outputs;}; + modules = [ + # > Our main home-manager configuration file < + ./home-manager/home.nix + ]; + }; + + "mike@server" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance + extraSpecialArgs = {inherit inputs outputs;}; + modules = [ + # > Our main home-manager configuration file < + ./home-manager/home.nix + ]; }; }; }; diff --git a/home-manager/home.nix b/home-manager/home.nix index ea73aff..ab7976d 100644 --- a/home-manager/home.nix +++ b/home-manager/home.nix @@ -1,74 +1,173 @@ -{hostname, ...}: { - imports = - if hostname == "zion" - then [ - ./programs/btop.nix - ./programs/fastfetch.nix - # ./programs/foot.nix - ./programs/git.nix - ./programs/gpg.nix - ./programs/helix.nix - ./programs/kitty.nix - ./programs/neovide.nix - ./programs/neovim.nix - ./programs/packages.nix - ./programs/shell.nix - ./programs/tmux.nix - ./programs/vscodium.nix +# { +# hostname, +# inputs, +# ... +# }: { +# imports = +# if hostname == "zion" +# then [ +# ./programs/btop.nix +# ./programs/fastfetch.nix +# # ./programs/foot.nix +# ./programs/git.nix +# ./programs/gpg.nix +# ./programs/helix.nix +# ./programs/kitty.nix +# ./programs/neovide.nix +# ./programs/neovim.nix +# ./programs/packages.nix +# ./programs/shell.nix +# ./programs/tmux.nix +# ./programs/vscodium.nix +# +# ./dwm +# # ./programs/yazi.nix +# # ./programs/zathura.nix +# +# # ./configs/keys.nix +# +# ./system/dunst.nix +# ./system/hypr.nix +# ./system/hyprland.nix +# ./system/rofi.nix +# ./system/stylix.nix +# ./system/theme.nix +# ./system/waybar.nix +# ./system/wlsunset.nix +# ./system/wofi.nix +# ] +# else if hostname == "thor" +# then [ +# ./programs/btop.nix +# ./programs/fastfetch.nix +# # ./programs/foot.nix +# ./programs/git.nix +# ./programs/gpg.nix +# ./programs/helix.nix +# ./programs/kitty.nix +# ./programs/neovide.nix +# ./programs/neovim.nix +# ./programs/packages.nix +# ./programs/shell.nix +# ./programs/tmux.nix +# ./programs/vscodium.nix +# # ./programs/yazi.nix +# # ./programs/zathura.nix +# +# # ./configs/keys.nix +# +# ./system/dunst.nix +# ./system/hyprland.nix +# ./system/rofi.nix +# ./system/stylix.nix +# ./system/theme.nix +# ./system/waybar.nix +# ./system/wlsunset.nix +# ./system/wofi.nix +# ] +# else if hostname == "server" +# then [ +# ./programs/git.nix +# ./programs/btop.nix +# ./programs/yazi.nix +# ./programs/shell.nix +# ./programs/helix.nix +# ./programs/fastfetch.nix +# ] +# else []; +# } +# This is your home-manager configuration file +# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + # You can import other home-manager modules here + imports = [ + # If you want to use modules your own flake exports (from modules/home-manager): + # outputs.homeManagerModules.example - ./dwm - # ./programs/yazi.nix - # ./programs/zathura.nix + # Or modules exported from other flakes (such as nix-colors): + # inputs.nix-colors.homeManagerModules.default - # ./configs/keys.nix + # You can also split up your configuration and import pieces of it here: + # ./nvim.nix + ./programs/btop.nix + ./programs/fastfetch.nix + # ./programs/foot.nix + ./programs/git.nix + ./programs/gpg.nix + ./programs/helix.nix + ./programs/kitty.nix + ./programs/neovide.nix + ./programs/neovim.nix + ./programs/packages.nix + ./programs/shell.nix + ./programs/tmux.nix + ./programs/vscodium.nix - ./system/dunst.nix - ./system/hypr.nix - ./system/hyprland.nix - ./system/rofi.nix - ./system/stylix.nix - ./system/theme.nix - ./system/waybar.nix - ./system/wlsunset.nix - ./system/wofi.nix - ] - else if hostname == "thor" - then [ - ./programs/btop.nix - ./programs/fastfetch.nix - # ./programs/foot.nix - ./programs/git.nix - ./programs/gpg.nix - ./programs/helix.nix - ./programs/kitty.nix - ./programs/neovide.nix - ./programs/neovim.nix - ./programs/packages.nix - ./programs/shell.nix - ./programs/tmux.nix - ./programs/vscodium.nix - # ./programs/yazi.nix - # ./programs/zathura.nix + ./dwm + # ./programs/yazi.nix + # ./programs/zathura.nix - # ./configs/keys.nix + # ./configs/keys.nix - ./system/dunst.nix - ./system/hyprland.nix - ./system/rofi.nix - ./system/stylix.nix - ./system/theme.nix - ./system/waybar.nix - ./system/wlsunset.nix - ./system/wofi.nix - ] - else if hostname == "server" - then [ - ./programs/git.nix - ./programs/btop.nix - ./programs/yazi.nix - ./programs/shell.nix - ./programs/helix.nix - ./programs/fastfetch.nix - ] - else []; + ./system/dunst.nix + # ./system/hypr.nix + # ./system/hyprland.nix + ./system/rofi.nix + # ./system/stylix.nix + ./system/theme.nix + ./system/waybar.nix + ./system/wlsunset.nix + ./system/wofi.nix + ]; + + nixpkgs = { + # You can add overlays here + overlays = [ + # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.unstable-packages + + # You can also add overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + # Configure your nixpkgs instance + config = { + # Disable if you don't want unfree packages + allowUnfree = true; + }; + }; + + home = { + username = "mike"; + homeDirectory = "/home/mike"; + }; + + # Add stuff for your user as you see fit: + # programs.neovim.enable = true; + # home.packages = with pkgs; [ steam ]; + + # Enable home-manager and git + programs.home-manager.enable = true; + programs.git.enable = true; + + # Nicely reload system units when changing configs + systemd.user.startServices = "sd-switch"; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + home.stateVersion = "24.11"; } diff --git a/home-manager/programs/packages.nix b/home-manager/programs/packages.nix index 0199901..5276801 100644 --- a/home-manager/programs/packages.nix +++ b/home-manager/programs/packages.nix @@ -51,7 +51,7 @@ # > desktop < # # firefox - whatsapp-for-linux + # whatsapp-for-linux telegram-desktop google-chrome chromium diff --git a/home-manager/system/stylix.nix b/home-manager/system/stylix.nix index 2a528ad..dfa80c1 100644 --- a/home-manager/system/stylix.nix +++ b/home-manager/system/stylix.nix @@ -66,19 +66,19 @@ monospace = { # package = pkgs.nerd-fonts.droid-sans-mono; - package = pkgs.nerdfonts.override { fonts = [ "DroidSansMono" ]; }; + package = pkgs.nerdfonts.override {fonts = ["DroidSansMono"];}; name = "DroidSansMono"; }; sansSerif = { # package = pkgs.nerd-fonts.droid-sans-mono; - package = pkgs.nerdfonts.override { fonts = [ "DroidSansMono" ]; }; + package = pkgs.nerdfonts.override {fonts = ["DroidSansMono"];}; name = "DroidSansMono"; }; serif = { # package = pkgs.nerd-fonts.droid-sans-mono; - package = pkgs.nerdfonts.override { fonts = [ "DroidSansMono" ]; }; + package = pkgs.nerdfonts.override {fonts = ["DroidSansMono"];}; name = "DroidSansMono"; }; }; diff --git a/hosts/default.nix b/hosts/default.nix deleted file mode 100644 index 6ccb48d..0000000 --- a/hosts/default.nix +++ /dev/null @@ -1,82 +0,0 @@ -{hostname, ...}: { - imports = - if hostname == "zion" - then [ - ./zion.nix - - ./modules/adb.nix - ./modules/ananicy.nix - # ./modules/bluetooth.nix - ./modules/boot.nix - ./modules/configuration.nix - ./modules/development.nix - ./modules/fstrim.nix - ./modules/gaming.nix - # ./modules/greetd.nix - ./modules/gsettings.nix - # ./modules/kde.nix - # ./modules/lanzaboot.nix - ./modules/network.nix - ./modules/nh.nix - ./modules/nvidia.nix - ./modules/ollama.nix - ./modules/packages.nix - ./modules/pipewire.nix - ./modules/printing.nix - ./modules/remote-builder.nix - ./modules/security.nix - ./modules/ssh.nix - ./modules/steam.nix - ./modules/users.nix - ./modules/vm.nix - ./modules/xserver.nix - ] - else if hostname == "thor" - then [ - ./thor.nix - - ./modules/adb.nix - ./modules/ananicy.nix - ./modules/bluetooth.nix - ./modules/boot.nix - ./modules/configuration.nix - ./modules/development.nix - ./modules/distributed-builds.nix - ./modules/fstrim.nix - ./modules/gaming.nix - ./modules/greetd.nix - ./modules/gsettings.nix - # ./modules/kde.nix - # ./modules/lanzaboot.nix - ./modules/network.nix - ./modules/nh.nix - # ./modules/nvidia.nix - ./modules/ollama.nix - ./modules/packages.nix - ./modules/pipewire.nix - ./modules/printing.nix - ./modules/security.nix - ./modules/ssh.nix - ./modules/tlp.nix - ./modules/users.nix - ./modules/vm.nix - ] - else if hostname == "server" - then [ - ./server.nix - - ./modules/nh.nix - ./modules/tlp.nix - ./modules/ssh.nix - ./modules/boot.nix - ./modules/users.nix - ./modules/nvidia.nix - ./modules/ollama.nix - ./modules/fstrim.nix - ./modules/system.nix - ./modules/network.nix - ./modules/configuration.nix - #./modules/lanzaboot.nix - ] - else []; -} diff --git a/hosts/modules/boot.nix b/hosts/modules/boot.nix index 773f381..f3cc2ef 100644 --- a/hosts/modules/boot.nix +++ b/hosts/modules/boot.nix @@ -1,14 +1,8 @@ { pkgs, - hostname, inputs, ... }: { - imports = - if hostname == "zion" - then [inputs.chaotic.nixosModules.default] - else []; - boot = { tmp.cleanOnBoot = true; @@ -22,13 +16,6 @@ }; }; - kernelPackages = - if hostname == "zion" - then pkgs.linuxPackages_zen #linuxPackages_zen #linuxPackages #linuxPackages_latest #linuxPackages_xanmod_latest - else if hostname == "thor" - then pkgs.linuxPackages - else if hostname == "server" - then pkgs.linuxPackages - else pkgs.linuxPackages_zen; + kernelPackages = pkgs.linuxPackages_zen; }; } diff --git a/hosts/modules/configuration.nix b/hosts/modules/common.nix similarity index 66% rename from hosts/modules/configuration.nix rename to hosts/modules/common.nix index c147768..d286b3d 100644 --- a/hosts/modules/configuration.nix +++ b/hosts/modules/common.nix @@ -1,7 +1,9 @@ { - hostname, + lib, inputs, + outputs, pkgs, + config, ... }: { time.timeZone = "Europe/Warsaw"; @@ -33,10 +35,10 @@ libinput = { enable = true; - mouse = { - accelProfile = "flat"; - accelSpeed = "0.0"; - }; + # mouse = { + # accelProfile = "flat"; + # accelSpeed = "0.0"; + # }; }; }; @@ -58,6 +60,24 @@ }; nixpkgs = { + # You can add overlays here + overlays = [ + # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.unstable-packages + + # You can also add overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + config = { # I'm sorry Richard Stallman allowUnfree = true; @@ -73,19 +93,27 @@ nixos.enable = true; }; - nix = { + nix = let + flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs; + in { daemonCPUSchedPolicy = "batch"; channel.enable = false; - nixPath = ["nixpkgs=${inputs.nixpkgs}"]; + # nixPath = ["nixpkgs=${inputs.nixpkgs}"]; optimise = { automatic = true; dates = ["daily"]; }; + # Opinionated: make flake registry and nix path match flake inputs + registry = lib.mapAttrs (_: flake: {inherit flake;}) flakeInputs; + nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs; + settings = { auto-optimise-store = true; experimental-features = ["nix-command" "flakes"]; + flake-registry = ""; + nix-path = config.nix.nixPath; substituters = [ "https://cache.nixos.org" diff --git a/hosts/modules/development.nix b/hosts/modules/development.nix index a2f72c7..37ac57b 100644 --- a/hosts/modules/development.nix +++ b/hosts/modules/development.nix @@ -4,7 +4,7 @@ rust-overlay, ... }: { - environment.systemPackages = with pkgs; [ + environment.systemPackages = with pkgs.unstable; [ # general docker docker-compose @@ -33,6 +33,7 @@ # # python # python311 # python311Packages.pip + uv # python311Packages.venvShellHook # cpp diff --git a/hosts/modules/gaming.nix b/hosts/modules/gaming.nix index ad6f0e2..45e8d73 100755 --- a/hosts/modules/gaming.nix +++ b/hosts/modules/gaming.nix @@ -1,9 +1,5 @@ -{ - pkgs, - username, - ... -}: { - users.users.${username}.packages = with pkgs; [heroic]; +{pkgs, ...}: { + users.users.mike.packages = with pkgs; [heroic]; hardware.steam-hardware.enable = true; programs = { diff --git a/hosts/modules/network.nix b/hosts/modules/network.nix index 49f0ef7..6a4038a 100644 --- a/hosts/modules/network.nix +++ b/hosts/modules/network.nix @@ -1,9 +1,8 @@ -{hostname, ...}: { +{ boot.initrd.systemd.network.wait-online.enable = false; systemd.services.NetworkManager-wait-online.enable = false; networking = { - hostName = "${hostname}"; firewall.enable = true; stevenblack = { diff --git a/hosts/modules/nh.nix b/hosts/modules/nh.nix index b86b857..938b77d 100644 --- a/hosts/modules/nh.nix +++ b/hosts/modules/nh.nix @@ -1,7 +1,7 @@ -{username, ...}: { +{ programs.nh = { enable = true; - flake = "/home/${username}/.files"; + flake = "/home/mike/.files"; clean = { enable = true; dates = "weekly"; diff --git a/hosts/modules/users.nix b/hosts/modules/users.nix index 6c54f22..8e83933 100644 --- a/hosts/modules/users.nix +++ b/hosts/modules/users.nix @@ -1,17 +1,15 @@ { inputs, - username, - hostname, pkgs, ... }: { - imports = [inputs.home-manager.nixosModules.home-manager]; + # imports = [inputs.home-manager.nixosModules.home-manager]; users.defaultUserShell = pkgs.zsh; - users.users.${username} = { + users.users.mike = { isNormalUser = true; - description = "${username}"; + description = "mike"; extraGroups = [ "networkmanager" "wheel" @@ -22,19 +20,19 @@ ]; }; - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - extraSpecialArgs = {inherit inputs username hostname;}; - - users.${username} = { - imports = [../../home-manager/home.nix]; - programs.home-manager.enable = true; - home = { - stateVersion = "24.05"; - username = "${username}"; - homeDirectory = "/home/${username}"; - }; - }; - }; + # home-manager = { + # useGlobalPkgs = true; + # useUserPackages = true; + # extraSpecialArgs = {inherit inputs username hostname;}; + # + # users.${username} = { + # imports = [../../home-manager/home.nix]; + # programs.home-manager.enable = true; + # home = { + # stateVersion = "24.05"; + # username = "${username}"; + # homeDirectory = "/home/${username}"; + # }; + # }; + # }; } diff --git a/hosts/modules/vm.nix b/hosts/modules/vm.nix index 26db097..a9aa7c3 100644 --- a/hosts/modules/vm.nix +++ b/hosts/modules/vm.nix @@ -1,9 +1,4 @@ -{ - pkgs, - username, - ... -}: { - users.users.${username}.extraGroups = ["libvirtd"]; +{pkgs, ...}: { boot.kernel.sysctl = {"vm.max_map_count" = 2147483642;}; # Install necessary packages diff --git a/hosts/server/configuration.nix b/hosts/server/configuration.nix new file mode 100644 index 0000000..3640a33 --- /dev/null +++ b/hosts/server/configuration.nix @@ -0,0 +1,43 @@ +# This is your system's configuration file. +# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + # You can import other NixOS modules here + imports = [ + # If you want to use modules your own flake exports (from modules/nixos): + # outputs.nixosModules.example + + # Or modules from other flakes (such as nixos-hardware): + # inputs.hardware.nixosModules.common-cpu-amd + # inputs.hardware.nixosModules.common-ssd + + # You can also split up your configuration and import pieces of it here: + # ./users.nix + + # Import your generated (nixos-generate-config) hardware configuration + ./hardware-configuration.nix + + ../modules/common.nix + + ../modules/nh.nix + ../modules/tlp.nix + ../modules/ssh.nix + ../modules/boot.nix + ../modules/users.nix + ../modules/nvidia.nix + ../modules/ollama.nix + ../modules/fstrim.nix + ../modules/system.nix + ../modules/network.nix + ../modules/configuration.nix + #../modules/lanzaboot.nix + ]; + + networking.hostName = "server"; +} diff --git a/hosts/thor/configuration.nix b/hosts/thor/configuration.nix new file mode 100644 index 0000000..43cf14e --- /dev/null +++ b/hosts/thor/configuration.nix @@ -0,0 +1,56 @@ +# This is your system's configuration file. +# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + # You can import other NixOS modules here + imports = [ + # If you want to use modules your own flake exports (from modules/nixos): + # outputs.nixosModules.example + + # Or modules from other flakes (such as nixos-hardware): + # inputs.hardware.nixosModules.common-cpu-amd + # inputs.hardware.nixosModules.common-ssd + + # You can also split up your configuration and import pieces of it here: + # ./users.nix + + # Import your generated (nixos-generate-config) hardware configuration + ./hardware-configuration.nix + + ../modules/common.nix + + ../modules/adb.nix + ../modules/ananicy.nix + ../modules/bluetooth.nix + ../modules/boot.nix + ../modules/configuration.nix + ../modules/development.nix + ../modules/distributed-builds.nix + ../modules/fstrim.nix + ../modules/gaming.nix + ../modules/greetd.nix + ../modules/gsettings.nix + # ../modules/kde.nix + # ../modules/lanzaboot.nix + ../modules/network.nix + ../modules/nh.nix + # ../modules/nvidia.nix + ../modules/ollama.nix + ../modules/packages.nix + ../modules/pipewire.nix + ../modules/printing.nix + ../modules/security.nix + ../modules/ssh.nix + ../modules/tlp.nix + ../modules/users.nix + ../modules/vm.nix + ]; + + networking.hostName = "thor"; +} diff --git a/hosts/thor.nix b/hosts/thor/hardware-configuration.nix similarity index 100% rename from hosts/thor.nix rename to hosts/thor/hardware-configuration.nix diff --git a/hosts/zion/configuration.nix b/hosts/zion/configuration.nix new file mode 100644 index 0000000..09b34f7 --- /dev/null +++ b/hosts/zion/configuration.nix @@ -0,0 +1,57 @@ +# This is your system's configuration file. +# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + # You can import other NixOS modules here + imports = [ + # If you want to use modules your own flake exports (from modules/nixos): + # outputs.nixosModules.example + + # Or modules from other flakes (such as nixos-hardware): + # inputs.hardware.nixosModules.common-cpu-amd + # inputs.hardware.nixosModules.common-ssd + + # You can also split up your configuration and import pieces of it here: + # ./users.nix + + # Import your generated (nixos-generate-config) hardware configuration + ./hardware-configuration.nix + + ../modules/common.nix + + ../modules/adb.nix + ../modules/ananicy.nix + # ../modules/bluetooth.nix + ../modules/boot.nix + ../modules/common.nix + ../modules/development.nix + ../modules/fstrim.nix + ../modules/gaming.nix + # ../modules/greetd.nix + ../modules/gsettings.nix + # ../modules/kde.nix + # ../modules/lanzaboot.nix + ../modules/network.nix + ../modules/nh.nix + ../modules/nvidia.nix + ../modules/ollama.nix + ../modules/packages.nix + ../modules/pipewire.nix + ../modules/printing.nix + ../modules/remote-builder.nix + ../modules/security.nix + ../modules/ssh.nix + ../modules/steam.nix + ../modules/users.nix + ../modules/vm.nix + ../modules/xserver.nix + ]; + + networking.hostName = "zion"; +} diff --git a/hosts/zion.nix b/hosts/zion/hardware-configuration.nix similarity index 100% rename from hosts/zion.nix rename to hosts/zion/hardware-configuration.nix diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix new file mode 100644 index 0000000..45aae31 --- /dev/null +++ b/modules/home-manager/default.nix @@ -0,0 +1,6 @@ +# Add your reusable home-manager modules to this directory, on their own file (https://nixos.wiki/wiki/Module). +# These should be stuff you would like to share with others, not your personal configurations. +{ + # List your module files here + # my-module = import ./my-module.nix; +} diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix new file mode 100644 index 0000000..8605069 --- /dev/null +++ b/modules/nixos/default.nix @@ -0,0 +1,6 @@ +# Add your reusable NixOS modules to this directory, on their own file (https://nixos.wiki/wiki/Module). +# These should be stuff you would like to share with others, not your personal configurations. +{ + # List your module files here + # my-module = import ./my-module.nix; +} diff --git a/overlays/default.nix b/overlays/default.nix index f327936..7bfcb4c 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,8 +1,7 @@ # This file defines overlays {inputs, ...}: { # This one brings our custom packages from the 'pkgs' directory - additions = final: _prev: - import ../pkgs {pkgs = final;}; + additions = final: _prev: import ../pkgs final.pkgs; # This one contains whatever you want to overlay # You can change versions, add patches, set compilation flags, anything really. @@ -13,23 +12,6 @@ # }); }; - # For every flake input, aliases 'pkgs.inputs.${flake}' to - # 'inputs.${flake}.packages.${pkgs.system}' or - # 'inputs.${flake}.legacyPackages.${pkgs.system}' - flake-inputs = final: _: { - inputs = - builtins.mapAttrs ( - _: flake: let - legacyPackages = (flake.legacyPackages or {}).${final.system} or {}; - packages = (flake.packages or {}).${final.system} or {}; - in - if legacyPackages != {} - then legacyPackages - else packages - ) - inputs; - }; - # When applied, the unstable nixpkgs set (declared in the flake inputs) will # be accessible through 'pkgs.unstable' unstable-packages = final: _prev: { diff --git a/pkgs/default.nix b/pkgs/default.nix new file mode 100644 index 0000000..3d9e23c --- /dev/null +++ b/pkgs/default.nix @@ -0,0 +1,5 @@ +# Custom packages, that can be defined similarly to ones from nixpkgs +# You can build them using 'nix build .#example' +pkgs: { + # example = pkgs.callPackage ./example { }; +}