From 23534315152c43f1d05504bf1d5f6197d1308461 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Mon, 19 Aug 2024 20:15:18 -0700 Subject: [PATCH 1/8] update system* *added overlay to build typst-lsp --- flake.lock | 84 ++++++++++++++++++++++---------------------- flake.nix | 15 ++++---- overlays/default.nix | 7 ++++ 3 files changed, 57 insertions(+), 49 deletions(-) create mode 100644 overlays/default.nix diff --git a/flake.lock b/flake.lock index 7f72b6f..3386095 100755 --- a/flake.lock +++ b/flake.lock @@ -24,11 +24,11 @@ }, "bleedingpkgs": { "locked": { - "lastModified": 1723688039, - "narHash": "sha256-/QVv3/9gnukdsUZRR5eJQLhcuXBCLe0rGrF5O6w6jA0=", + "lastModified": 1724117083, + "narHash": "sha256-26Zgap4D9E8PRL9jvc4Df9POMNGFS9fMwKz+SiGrlXI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "1ad352fd9ea96cebc7862782fa8d0d295c68ff15", + "rev": "44f636f8cb95238dabd5f33d00557329c0681cd5", "type": "github" }, "original": { @@ -57,11 +57,11 @@ }, "catppuccin": { "locked": { - "lastModified": 1722997334, - "narHash": "sha256-vE5FcKVQ3E0txJKt5w3vOlfcN1XoTAlxK9PnQ/CJavA=", + "lastModified": 1724048768, + "narHash": "sha256-OZ9OXsPQi+fNdMM7SBPtU8OB1ntLzOvUwA/3zYJY6Eo=", "owner": "catppuccin", "repo": "nix", - "rev": "66f4ea170093b62f319f41cebd2337a51b225c5a", + "rev": "ff4128f8ea57879050145cf077a27b9d3a9cbf33", "type": "github" }, "original": { @@ -303,11 +303,11 @@ ] }, "locked": { - "lastModified": 1723202784, - "narHash": "sha256-qbhjc/NEGaDbyy0ucycubq4N3//gDFFH3DOmp1D3u1Q=", + "lastModified": 1723803910, + "narHash": "sha256-yezvUuFiEnCFbGuwj/bQcqg7RykIEqudOy/RBrId0pc=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "c7012d0c18567c889b948781bc74a501e92275d1", + "rev": "bfef0ada09e2c8ac55bbcd0831bd0c9d42e651ba", "type": "github" }, "original": { @@ -367,11 +367,11 @@ ] }, "locked": { - "lastModified": 1723399884, - "narHash": "sha256-97wn0ihhGqfMb8WcUgzzkM/TuAxce2Gd20A8oiruju4=", + "lastModified": 1723986931, + "narHash": "sha256-Fy+KEvDQ+Hc8lJAV3t6leXhZJ2ncU5/esxkgt3b8DEY=", "owner": "nix-community", "repo": "home-manager", - "rev": "086f619dd991a4d355c07837448244029fc2d9ab", + "rev": "2598861031b78aadb4da7269df7ca9ddfc3e1671", "type": "github" }, "original": { @@ -388,11 +388,11 @@ ] }, "locked": { - "lastModified": 1723399884, - "narHash": "sha256-97wn0ihhGqfMb8WcUgzzkM/TuAxce2Gd20A8oiruju4=", + "lastModified": 1723986931, + "narHash": "sha256-Fy+KEvDQ+Hc8lJAV3t6leXhZJ2ncU5/esxkgt3b8DEY=", "owner": "nix-community", "repo": "home-manager", - "rev": "086f619dd991a4d355c07837448244029fc2d9ab", + "rev": "2598861031b78aadb4da7269df7ca9ddfc3e1671", "type": "github" }, "original": { @@ -404,11 +404,11 @@ "homebrew-cask": { "flake": false, "locked": { - "lastModified": 1723687108, - "narHash": "sha256-yS7kiSJyJzd+mpzAQ1ntrfejGICEhScev6NA0F5rsDE=", + "lastModified": 1724120139, + "narHash": "sha256-vVE53gBCJPc3/dj7OHvQ7mNuUk1bWVpNR4c0jKe+K9U=", "owner": "homebrew", "repo": "homebrew-cask", - "rev": "5feec29994320afeeb5a1a74860a57d9f845bc30", + "rev": "606d3429e6fae79849c0eaf4bbcf05ff1570051a", "type": "github" }, "original": { @@ -420,11 +420,11 @@ "homebrew-core": { "flake": false, "locked": { - "lastModified": 1723681288, - "narHash": "sha256-uU0etusCLcip1KNB2FA8/Zpi+hGwAzKX9X32fdFnTNw=", + "lastModified": 1724119620, + "narHash": "sha256-p+M24z3IDeIJBppaWWTpaz63WMGvi3HGW/mQHQVYpgM=", "owner": "homebrew", "repo": "homebrew-core", - "rev": "5bf3c1c505315f0adff00ce8921169fbf7df217c", + "rev": "cd06a79081ce6e08b475e01315cdf1cb51952d77", "type": "github" }, "original": { @@ -502,11 +502,11 @@ ] }, "locked": { - "lastModified": 1722924007, - "narHash": "sha256-+CQDamNwqO33REJLft8c26NbUi2Td083hq6SvAm2xkU=", + "lastModified": 1723859949, + "narHash": "sha256-kiaGz4deGYKMjJPOji/JVvSP/eTefrIA3rAjOnOpXl4=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "91010a5613ffd7ee23ee9263213157a1c422b705", + "rev": "076b9a905af8a52b866c8db068d6da475839d97b", "type": "github" }, "original": { @@ -541,11 +541,11 @@ ] }, "locked": { - "lastModified": 1722924007, - "narHash": "sha256-+CQDamNwqO33REJLft8c26NbUi2Td083hq6SvAm2xkU=", + "lastModified": 1723859949, + "narHash": "sha256-kiaGz4deGYKMjJPOji/JVvSP/eTefrIA3rAjOnOpXl4=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "91010a5613ffd7ee23ee9263213157a1c422b705", + "rev": "076b9a905af8a52b866c8db068d6da475839d97b", "type": "github" }, "original": { @@ -622,11 +622,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1723362943, - "narHash": "sha256-dFZRVSgmJkyM0bkPpaYRtG/kRMRTorUIDj8BxoOt1T4=", + "lastModified": 1723991338, + "narHash": "sha256-Grh5PF0+gootJfOJFenTTxDTYPidA3V28dqJ/WV7iis=", "owner": "nixos", "repo": "nixpkgs", - "rev": "a58bc8ad779655e790115244571758e8de055e3d", + "rev": "8a3354191c0d7144db9756a74755672387b702ba", "type": "github" }, "original": { @@ -651,11 +651,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1723816538, - "narHash": "sha256-h37ltjdifkd7iLtMtBXSBBeYSTuBEKMW6ClFoC7nReQ=", + "lastModified": 1724118730, + "narHash": "sha256-UwtVD2FyD7FjfLLmqGLsCBCQgLC1Jj78e1PhiVb0MJk=", "owner": "nix-community", "repo": "nixvim", - "rev": "00f32f0430f82c74919c72af84bc95bf5ae434e4", + "rev": "39081a41067a7bdb66f6f85a3fee9693ff8a21b1", "type": "github" }, "original": { @@ -673,11 +673,11 @@ ] }, "locked": { - "lastModified": 1723367906, - "narHash": "sha256-v1qA4WBGDI2uH/TVqRwuXSBP341W681psbzYJ8zrjog=", + "lastModified": 1723969429, + "narHash": "sha256-BuewfNEXEf11MIkJY+uvWsdLu1dIvgJqntWChvNdALg=", "owner": "NuschtOS", "repo": "search", - "rev": "6ca2c3ae05a915c160512bd41f6810f456c9b30d", + "rev": "a05d1805f2a2bc47d230e5e92aecbf69f784f3d0", "type": "github" }, "original": { @@ -773,11 +773,11 @@ }, "stablepkgs": { "locked": { - "lastModified": 1723556749, - "narHash": "sha256-+CHVZnTnIYRLYsARInHYoWkujzcRkLY/gXm3s5bE52o=", + "lastModified": 1723938990, + "narHash": "sha256-9tUadhnZQbWIiYVXH8ncfGXGvkNq3Hag4RCBEMUk7MI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "4a92571f9207810b559c9eac203d1f4d79830073", + "rev": "c42fcfbdfeae23e68fc520f9182dde9f38ad1890", "type": "github" }, "original": { @@ -855,11 +855,11 @@ ] }, "locked": { - "lastModified": 1723454642, - "narHash": "sha256-S0Gvsenh0II7EAaoc9158ZB4vYyuycvMGKGxIbERNAM=", + "lastModified": 1723808491, + "narHash": "sha256-rhis3qNuGmJmYC/okT7Dkc4M8CeUuRCSvW6kC2f3hBc=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "349de7bc435bdff37785c2466f054ed1766173be", + "rev": "1d07739554fdc4f8481068f1b11d6ab4c1a4167a", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 593cd6f..95eda5d 100755 --- a/flake.nix +++ b/flake.nix @@ -68,6 +68,7 @@ ./modules/nixos/fonts ./modules/nixos/greeter ./modules/nixos/core + ./overlays catppuccin.nixosModules.catppuccin lix-module.nixosModules.default @@ -83,10 +84,10 @@ ./users/youwen/linux/packages/x86_64 ./users/youwen/linux/programs ./users/youwen/common/neofetch - ./users/youwen/common/neovim + ./users/youwen/common/neovim ./users/youwen/common inputs.catppuccin.homeManagerModules.catppuccin - inputs.nixvim.homeManagerModules.nixvim + inputs.nixvim.homeManagerModules.nixvim ]; }; } @@ -117,10 +118,10 @@ ./users/youwen/common/neofetch/asahi-only.nix ./users/youwen/linux/laptop ./users/youwen/linux/packages/aarch-64 - ./users/youwen/common/neovim + ./users/youwen/common/neovim inputs.catppuccin.homeManagerModules.catppuccin - inputs.nixvim.homeManagerModules.nixvim + inputs.nixvim.homeManagerModules.nixvim ]; }; } @@ -159,12 +160,12 @@ ./users/youwen/linux/laptop ./users/youwen/linux/packages/x86_64 ./users/youwen/linux/programs - ./users/youwen/common/neovim + ./users/youwen/common/neovim ./users/youwen/common ./users/youwen/common/neofetch ./hosts/adrastea/home-manager-overrides.nix inputs.catppuccin.homeManagerModules.catppuccin - inputs.nixvim.homeManagerModules.nixvim + inputs.nixvim.homeManagerModules.nixvim ]; }; } @@ -187,7 +188,7 @@ ./users/youwen/darwin/darwin-home.nix ./users/youwen/common/core.nix ./users/youwen/common/neofetch - ./users/youwen/common/neovim + ./users/youwen/common/neovim ]; home-manager.backupFileExtension = "backup"; diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..268d5f5 --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,7 @@ +{inputs, ...}: { + nixpkgs.overlays = [ + (self: super: { + typst-lsp = inputs.stablepkgs.legacyPackages.${self.system}.typst-lsp; + }) + ]; +} From c9084eafa3de6c4dc5c41c692e4a4e7abd61b5f9 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Tue, 20 Aug 2024 15:54:55 -0700 Subject: [PATCH 2/8] chore: space out flake inputs --- flake.nix | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 95eda5d..28f2096 100755 --- a/flake.nix +++ b/flake.nix @@ -3,38 +3,52 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; + stablepkgs.url = "github:nixos/nixpkgs/nixos-24.05"; + bleedingpkgs.url = "github:nixos/nixpkgs/master"; - nix-darwin.url = "github:LnL7/nix-darwin"; - nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; + + nix-darwin = { + url = "github:LnL7/nix-darwin"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nix-homebrew.url = "github:zhaofengli-wip/nix-homebrew"; + homebrew-core = { url = "github:homebrew/homebrew-core"; flake = false; }; + homebrew-cask = { url = "github:homebrew/homebrew-cask"; flake = false; }; + catppuccin.url = "github:catppuccin/nix"; + lanzaboote = { url = "github:nix-community/lanzaboote/v0.4.1"; # Optional but recommended to limit the size of your system closure. inputs.nixpkgs.follows = "nixpkgs"; }; + lix-module = { url = "https://git.lix.systems/lix-project/nixos-module/archive/2.90.0.tar.gz"; inputs.nixpkgs.follows = "nixpkgs"; }; + apple-silicon = { url = "github:tpwrules/nixos-apple-silicon"; inputs.nixpkgs.follows = "nixpkgs"; }; + nixvim = { url = "github:nix-community/nixvim"; inputs.nixpkgs.follows = "nixpkgs"; From 3e61b30e64d05f2948e2a3ab129c9bd3e6e89f98 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Tue, 20 Aug 2024 16:51:48 -0700 Subject: [PATCH 3/8] refactor: move out of flake.nix to hosts --- flake.nix | 32 +-- hosts/demeter/configuration.nix | 210 +++++++++++++++++ hosts/demeter/default.nix | 234 +++---------------- hosts/demeter/hardware-configuration.nix.old | 39 ---- 4 files changed, 242 insertions(+), 273 deletions(-) create mode 100755 hosts/demeter/configuration.nix mode change 100755 => 100644 hosts/demeter/default.nix delete mode 100755 hosts/demeter/hardware-configuration.nix.old diff --git a/flake.nix b/flake.nix index 28f2096..8af3446 100755 --- a/flake.nix +++ b/flake.nix @@ -76,37 +76,9 @@ system = "x86_64-linux"; modules = [ ./hosts/demeter - ./modules/nixos/gaming - ./modules/nixos/audio - ./modules/nixos/networking - ./modules/nixos/fonts - ./modules/nixos/greeter - ./modules/nixos/core - ./overlays - - catppuccin.nixosModules.catppuccin - lix-module.nixosModules.default - lanzaboote.nixosModules.lanzaboote - home-manager.nixosModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.backupFileExtension = "backup"; - home-manager.users.youwen = { - imports = [ - ./users/youwen/linux/desktop - ./users/youwen/linux/packages/x86_64 - ./users/youwen/linux/programs - ./users/youwen/common/neofetch - ./users/youwen/common/neovim - ./users/youwen/common - inputs.catppuccin.homeManagerModules.catppuccin - inputs.nixvim.homeManagerModules.nixvim - ]; - }; - } ]; }; + callisto = nixpkgs.lib.nixosSystem { specialArgs = {inherit inputs;}; system = "aarch64-linux"; @@ -117,6 +89,7 @@ ./modules/nixos/fonts ./modules/nixos/greeter ./modules/nixos/core + ./overlays apple-silicon.nixosModules.apple-silicon-support catppuccin.nixosModules.catppuccin @@ -160,6 +133,7 @@ ./modules/nixos/fonts ./modules/nixos/greeter ./modules/nixos/core + ./overlays catppuccin.nixosModules.catppuccin lix-module.nixosModules.default diff --git a/hosts/demeter/configuration.nix b/hosts/demeter/configuration.nix new file mode 100755 index 0000000..2adccad --- /dev/null +++ b/hosts/demeter/configuration.nix @@ -0,0 +1,210 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). +{ + config, + inputs, + pkgs, + lib, + ... +}: { + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # Bootloader. + boot.loader = { + efi.canTouchEfiVariables = true; + timeout = 15; + # Lanzaboote currently replaces the systemd-boot module. + # This setting is usually set to true in configuration.nix + # generated at installation time. So we force it to false + # for now. + systemd-boot = { + enable = false; + consoleMode = "auto"; + }; + }; + + boot.lanzaboote = { + enable = true; + pkiBundle = "/etc/secureboot"; + }; + + boot.initrd.luks.devices."luks-af320a0f-b388-43f5-b5a3-af2b47cfc716".device = "/dev/disk/by-uuid/af320a0f-b388-43f5-b5a3-af2b47cfc716"; + + networking.hostName = "demeter"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # select kernel + boot.kernelPackages = pkgs.linuxPackages_zen; + + # 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. + time.timeZone = "America/Los_Angeles"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + + systemd.services = {NetworkManager-wait-online.enable = false;}; + + # Enable the X11 windowing system. + # You can disable this if you're only using the Wayland session. + services.xserver.enable = false; + + programs.nix-ld = { + enable = true; + libraries = with pkgs; [icu xorg.libXtst xorg.libXi]; + }; + + hardware.nvidia = { + modesetting.enable = true; + powerManagement.enable = true; + powerManagement.finegrained = false; + open = false; + nvidiaSettings = true; + }; + + hardware.bluetooth = { + enable = true; + powerOnBoot = true; + }; + + services.blueman.enable = true; + + hardware.graphics.enable = true; + + hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable; + + services.xserver.videoDrivers = ["nvidia"]; + + services.flatpak.enable = true; + + # services.desktopManager.plasma6.enable = true; + + # Configure keymap in X11 + services.xserver = { + xkb.layout = "us"; + xkb.variant = ""; + }; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.youwen = { + isNormalUser = true; + description = "Youwen Wu"; + extraGroups = ["networkmanager" "wheel" "nixos" "realtime"]; + }; + + users.groups.realtime = {}; + + nix.settings = { + trusted-users = ["root" "youwen"]; + experimental-features = ["nix-command" "flakes"]; + }; + + services.udev.extraRules = '' + KERNEL=="cpu_dma_latency", GROUP="realtime" + ''; + + security.pam.loginLimits = [ + { + domain = "@realtime"; + type = "-"; + item = "rtprio"; + value = 98; + } + { + domain = "@realtime"; + type = "-"; + item = "memlock"; + value = "unlimited"; + } + { + domain = "@realtime"; + type = "-"; + item = "nice"; + value = -11; + } + ]; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + neovim + wget + git + curl + librewolf + gnumake + gcc + cachix + gnupg + openssh + python3 + steam-run + + # deps for neovim compilation + lua51Packages.lua + lua51Packages.luarocks + tree-sitter + ]; + + environment.variables = { + EDITOR = "nvim"; + NIX_AUTO_RUN = 1; + }; + + # tells electron apps to use Wayland + environment.sessionVariables.NIXOS_OZONE_WL = "1"; + + # 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; + }; + + programs.dconf.enable = true; + + programs.hyprland.enable = true; + + programs.zsh.enable = false; + programs.fish.enable = true; + users.users.youwen.shell = pkgs.fish; + # 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 = "24.05"; # Did you read the comment? +} diff --git a/hosts/demeter/default.nix b/hosts/demeter/default.nix old mode 100755 new mode 100644 index 2adccad..109f20b --- a/hosts/demeter/default.nix +++ b/hosts/demeter/default.nix @@ -1,210 +1,34 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). -{ - config, - inputs, - pkgs, - lib, - ... -}: { - imports = [ - # Include the results of the hardware scan. - ./hardware-configuration.nix - ]; +{inputs, ...}: { + imports = with inputs; [ + ./configuration.nix + ../../modules/nixos/gaming + ../../modules/nixos/audio + ../../modules/nixos/networking + ../../modules/nixos/fonts + ../../modules/nixos/greeter + ../../modules/nixos/core + ../../overlays - # Bootloader. - boot.loader = { - efi.canTouchEfiVariables = true; - timeout = 15; - # Lanzaboote currently replaces the systemd-boot module. - # This setting is usually set to true in configuration.nix - # generated at installation time. So we force it to false - # for now. - systemd-boot = { - enable = false; - consoleMode = "auto"; - }; - }; - - boot.lanzaboote = { - enable = true; - pkiBundle = "/etc/secureboot"; - }; - - boot.initrd.luks.devices."luks-af320a0f-b388-43f5-b5a3-af2b47cfc716".device = "/dev/disk/by-uuid/af320a0f-b388-43f5-b5a3-af2b47cfc716"; - - networking.hostName = "demeter"; # Define your hostname. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - # select kernel - boot.kernelPackages = pkgs.linuxPackages_zen; - - # 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. - time.timeZone = "America/Los_Angeles"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "en_US.UTF-8"; - LC_IDENTIFICATION = "en_US.UTF-8"; - LC_MEASUREMENT = "en_US.UTF-8"; - LC_MONETARY = "en_US.UTF-8"; - LC_NAME = "en_US.UTF-8"; - LC_NUMERIC = "en_US.UTF-8"; - LC_PAPER = "en_US.UTF-8"; - LC_TELEPHONE = "en_US.UTF-8"; - LC_TIME = "en_US.UTF-8"; - }; - - systemd.services = {NetworkManager-wait-online.enable = false;}; - - # Enable the X11 windowing system. - # You can disable this if you're only using the Wayland session. - services.xserver.enable = false; - - programs.nix-ld = { - enable = true; - libraries = with pkgs; [icu xorg.libXtst xorg.libXi]; - }; - - hardware.nvidia = { - modesetting.enable = true; - powerManagement.enable = true; - powerManagement.finegrained = false; - open = false; - nvidiaSettings = true; - }; - - hardware.bluetooth = { - enable = true; - powerOnBoot = true; - }; - - services.blueman.enable = true; - - hardware.graphics.enable = true; - - hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable; - - services.xserver.videoDrivers = ["nvidia"]; - - services.flatpak.enable = true; - - # services.desktopManager.plasma6.enable = true; - - # Configure keymap in X11 - services.xserver = { - xkb.layout = "us"; - xkb.variant = ""; - }; - - # Enable CUPS to print documents. - services.printing.enable = true; - - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.youwen = { - isNormalUser = true; - description = "Youwen Wu"; - extraGroups = ["networkmanager" "wheel" "nixos" "realtime"]; - }; - - users.groups.realtime = {}; - - nix.settings = { - trusted-users = ["root" "youwen"]; - experimental-features = ["nix-command" "flakes"]; - }; - - services.udev.extraRules = '' - KERNEL=="cpu_dma_latency", GROUP="realtime" - ''; - - security.pam.loginLimits = [ + catppuccin.nixosModules.catppuccin + lix-module.nixosModules.default + lanzaboote.nixosModules.lanzaboote + home-manager.nixosModules.home-manager { - domain = "@realtime"; - type = "-"; - item = "rtprio"; - value = 98; - } - { - domain = "@realtime"; - type = "-"; - item = "memlock"; - value = "unlimited"; - } - { - domain = "@realtime"; - type = "-"; - item = "nice"; - value = -11; + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.backupFileExtension = "backup"; + home-manager.users.youwen = { + imports = [ + ../../users/youwen/linux/desktop + ../../users/youwen/linux/packages/x86_64 + ../../users/youwen/linux/programs + ../../users/youwen/common/neofetch + ../../users/youwen/common/neovim + ../../users/youwen/common + inputs.catppuccin.homeManagerModules.catppuccin + inputs.nixvim.homeManagerModules.nixvim + ]; + }; } ]; - - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - neovim - wget - git - curl - librewolf - gnumake - gcc - cachix - gnupg - openssh - python3 - steam-run - - # deps for neovim compilation - lua51Packages.lua - lua51Packages.luarocks - tree-sitter - ]; - - environment.variables = { - EDITOR = "nvim"; - NIX_AUTO_RUN = 1; - }; - - # tells electron apps to use Wayland - environment.sessionVariables.NIXOS_OZONE_WL = "1"; - - # 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; - }; - - programs.dconf.enable = true; - - programs.hyprland.enable = true; - - programs.zsh.enable = false; - programs.fish.enable = true; - users.users.youwen.shell = pkgs.fish; - # 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 = "24.05"; # Did you read the comment? } diff --git a/hosts/demeter/hardware-configuration.nix.old b/hosts/demeter/hardware-configuration.nix.old deleted file mode 100755 index df06d01..0000000 --- a/hosts/demeter/hardware-configuration.nix.old +++ /dev/null @@ -1,39 +0,0 @@ -# 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 = - [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = { - device = "/dev/disk/by-uuid/2616d86c-aac2-4780-9527-7b11192e783f"; - fsType = "ext4"; - }; - - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/B826-E14B"; - fsType = "vfat"; - options = [ "fmask=0022" "dmask=0022" ]; - }; - - swapDevices = [ ]; - - # 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.enp6s0.useDHCP = lib.mkDefault true; - # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = - lib.mkDefault config.hardware.enableRedistributableFirmware; -} From 6fce20dc97556bda05758a045733a59f8aed43c8 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Tue, 20 Aug 2024 19:43:44 -0700 Subject: [PATCH 4/8] refactor: migrate callisto --- flake.nix | 36 ---- hosts/callisto/configuration.nix | 198 ++++++++++++++++++++++ hosts/callisto/default.nix | 221 ++++--------------------- hosts/demeter/home-manager/default.nix | 0 4 files changed, 226 insertions(+), 229 deletions(-) create mode 100755 hosts/callisto/configuration.nix mode change 100755 => 100644 hosts/callisto/default.nix create mode 100644 hosts/demeter/home-manager/default.nix diff --git a/flake.nix b/flake.nix index 8af3446..cd73b13 100755 --- a/flake.nix +++ b/flake.nix @@ -84,42 +84,6 @@ system = "aarch64-linux"; modules = [ ./hosts/callisto - ./modules/nixos/audio - ./modules/nixos/networking - ./modules/nixos/fonts - ./modules/nixos/greeter - ./modules/nixos/core - ./overlays - - apple-silicon.nixosModules.apple-silicon-support - catppuccin.nixosModules.catppuccin - lix-module.nixosModules.default - home-manager.nixosModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.backupFileExtension = "backup"; - home-manager.users.youwen = { - imports = [ - ./users/youwen/common - ./users/youwen/common/neofetch/asahi-only.nix - ./users/youwen/linux/laptop - ./users/youwen/linux/packages/aarch-64 - ./users/youwen/common/neovim - - inputs.catppuccin.homeManagerModules.catppuccin - inputs.nixvim.homeManagerModules.nixvim - ]; - }; - } - { - nixpkgs.overlays = [ - (self: super: { - signal-desktop = - bleedingpkgs.legacyPackages.${self.system}.signal-desktop; - }) - ]; - } ]; }; adrastea = nixpkgs.lib.nixosSystem { diff --git a/hosts/callisto/configuration.nix b/hosts/callisto/configuration.nix new file mode 100755 index 0000000..e39ca0d --- /dev/null +++ b/hosts/callisto/configuration.nix @@ -0,0 +1,198 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). +{ + config, + inputs, + pkgs, + ... +}: { + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + # ./apple-silicon-support + ]; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = false; + + hardware.asahi = { + peripheralFirmwareDirectory = ./firmware; + useExperimentalGPUDriver = true; + experimentalGPUInstallMode = "overlay"; + }; + + boot.extraModprobeConfig = '' + options hid_apple iso_layout=0 + ''; + + boot.kernelParams = ["apple_dcp.show_notch=1"]; + + networking.hostName = "callisto"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + networking.wireless.iwd = { + enable = true; + settings.General.EnableNetworkConfiguration = true; + }; + + nixpkgs.overlays = [inputs.apple-silicon.overlays.apple-silicon-overlay]; + + programs.light.enable = true; + + # 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. + time.timeZone = "America/Los_Angeles"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + + # Enable the X11 windowing system. + # You can disable this if you're only using the Wayland session. + services.xserver.enable = false; + + programs.nix-ld = { + enable = true; + libraries = with pkgs; [icu xorg.libXtst xorg.libXi]; + }; + + # Configure keymap in X11 + services.xserver = { + xkb.layout = "us"; + xkb.variant = ""; + }; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.youwen = { + isNormalUser = true; + description = "Youwen Wu"; + extraGroups = ["networkmanager" "wheel" "nixos" "realtime"]; + }; + + users.groups.realtime = {}; + + nix.settings = { + trusted-users = ["root" "youwen"]; + experimental-features = ["nix-command" "flakes"]; + }; + + services.udev.extraRules = '' + KERNEL=="cpu_dma_latency", GROUP="realtime" + KERNEL=="macsmc-battery", SUBSYSTEM=="power_supply", ATTR{charge_control_end_threshold}="80", ATTR{charge_control_start_threshold}="70" + ''; + + security.pam.loginLimits = [ + { + domain = "@realtime"; + type = "-"; + item = "rtprio"; + value = 98; + } + { + domain = "@realtime"; + type = "-"; + item = "memlock"; + value = "unlimited"; + } + { + domain = "@realtime"; + type = "-"; + item = "nice"; + value = -11; + } + ]; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + neovim + wget + git + curl + ]; + + environment.variables = { + EDITOR = "nvim"; + NIX_AUTO_RUN = 1; + }; + services.keyd = { + enable = true; + keyboards = { + default = { + ids = ["*"]; + settings = { + main = { + capslock = "esc"; + leftmeta = "leftcontrol"; + leftalt = "leftmeta"; + leftcontrol = "leftalt"; + rightmeta = "leftalt"; + rightalt = "layer(rightalt)"; + }; + rightalt = { + i = "up"; + j = "left"; + k = "down"; + l = "right"; + }; + }; + }; + }; + }; + + services.tlp.enable = true; + + # tells electron apps to use Wayland + environment.sessionVariables.NIXOS_OZONE_WL = "1"; + + # 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; + }; + + programs.dconf.enable = true; + + programs.hyprland.enable = true; + + # 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 = "24.11"; # Did you read the comment? + + programs.zsh.enable = false; + programs.fish.enable = true; + users.users.youwen.shell = pkgs.fish; +} diff --git a/hosts/callisto/default.nix b/hosts/callisto/default.nix old mode 100755 new mode 100644 index e39ca0d..72c2bfa --- a/hosts/callisto/default.nix +++ b/hosts/callisto/default.nix @@ -1,198 +1,33 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). -{ - config, - inputs, - pkgs, - ... -}: { - imports = [ - # Include the results of the hardware scan. - ./hardware-configuration.nix - # ./apple-silicon-support - ]; +{inputs, ...}: { + imports = with inputs; [ + ./configuration.nix + ../../modules/nixos/audio + ../../modules/nixos/networking + ../../modules/nixos/fonts + ../../modules/nixos/greeter + ../../modules/nixos/core + ../../overlays - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = false; - - hardware.asahi = { - peripheralFirmwareDirectory = ./firmware; - useExperimentalGPUDriver = true; - experimentalGPUInstallMode = "overlay"; - }; - - boot.extraModprobeConfig = '' - options hid_apple iso_layout=0 - ''; - - boot.kernelParams = ["apple_dcp.show_notch=1"]; - - networking.hostName = "callisto"; # Define your hostname. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - networking.wireless.iwd = { - enable = true; - settings.General.EnableNetworkConfiguration = true; - }; - - nixpkgs.overlays = [inputs.apple-silicon.overlays.apple-silicon-overlay]; - - programs.light.enable = true; - - # 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. - time.timeZone = "America/Los_Angeles"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "en_US.UTF-8"; - LC_IDENTIFICATION = "en_US.UTF-8"; - LC_MEASUREMENT = "en_US.UTF-8"; - LC_MONETARY = "en_US.UTF-8"; - LC_NAME = "en_US.UTF-8"; - LC_NUMERIC = "en_US.UTF-8"; - LC_PAPER = "en_US.UTF-8"; - LC_TELEPHONE = "en_US.UTF-8"; - LC_TIME = "en_US.UTF-8"; - }; - - # Enable the X11 windowing system. - # You can disable this if you're only using the Wayland session. - services.xserver.enable = false; - - programs.nix-ld = { - enable = true; - libraries = with pkgs; [icu xorg.libXtst xorg.libXi]; - }; - - # Configure keymap in X11 - services.xserver = { - xkb.layout = "us"; - xkb.variant = ""; - }; - - # Enable CUPS to print documents. - services.printing.enable = true; - - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.youwen = { - isNormalUser = true; - description = "Youwen Wu"; - extraGroups = ["networkmanager" "wheel" "nixos" "realtime"]; - }; - - users.groups.realtime = {}; - - nix.settings = { - trusted-users = ["root" "youwen"]; - experimental-features = ["nix-command" "flakes"]; - }; - - services.udev.extraRules = '' - KERNEL=="cpu_dma_latency", GROUP="realtime" - KERNEL=="macsmc-battery", SUBSYSTEM=="power_supply", ATTR{charge_control_end_threshold}="80", ATTR{charge_control_start_threshold}="70" - ''; - - security.pam.loginLimits = [ + apple-silicon.nixosModules.apple-silicon-support + catppuccin.nixosModules.catppuccin + lix-module.nixosModules.default + home-manager.nixosModules.home-manager { - domain = "@realtime"; - type = "-"; - item = "rtprio"; - value = 98; - } - { - domain = "@realtime"; - type = "-"; - item = "memlock"; - value = "unlimited"; - } - { - domain = "@realtime"; - type = "-"; - item = "nice"; - value = -11; - } - ]; + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.backupFileExtension = "backup"; + home-manager.users.youwen = { + imports = [ + ../../users/youwen/common + ../../users/youwen/common/neofetch/asahi-only.nix + ../../users/youwen/linux/laptop + ../../users/youwen/linux/packages/aarch-64 + ../../users/youwen/common/neovim - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - neovim - wget - git - curl - ]; - - environment.variables = { - EDITOR = "nvim"; - NIX_AUTO_RUN = 1; - }; - services.keyd = { - enable = true; - keyboards = { - default = { - ids = ["*"]; - settings = { - main = { - capslock = "esc"; - leftmeta = "leftcontrol"; - leftalt = "leftmeta"; - leftcontrol = "leftalt"; - rightmeta = "leftalt"; - rightalt = "layer(rightalt)"; - }; - rightalt = { - i = "up"; - j = "left"; - k = "down"; - l = "right"; - }; - }; + inputs.catppuccin.homeManagerModules.catppuccin + inputs.nixvim.homeManagerModules.nixvim + ]; }; - }; - }; - - services.tlp.enable = true; - - # tells electron apps to use Wayland - environment.sessionVariables.NIXOS_OZONE_WL = "1"; - - # 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; - }; - - programs.dconf.enable = true; - - programs.hyprland.enable = true; - - # 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 = "24.11"; # Did you read the comment? - - programs.zsh.enable = false; - programs.fish.enable = true; - users.users.youwen.shell = pkgs.fish; + } + ]; } diff --git a/hosts/demeter/home-manager/default.nix b/hosts/demeter/home-manager/default.nix new file mode 100644 index 0000000..e69de29 From f81c7f795c831688a50fa24e30ba39d201986cdb Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Tue, 20 Aug 2024 19:51:08 -0700 Subject: [PATCH 5/8] refactor: complete new hosts system --- flake.nix | 60 +---- hosts/adrastea/configuration.nix | 227 ++++++++++++++++ hosts/adrastea/default.nix | 252 +++--------------- .../default.nix} | 0 hosts/phobos/configuration.nix | 57 ++++ hosts/phobos/default.nix | 77 ++---- 6 files changed, 341 insertions(+), 332 deletions(-) create mode 100755 hosts/adrastea/configuration.nix mode change 100755 => 100644 hosts/adrastea/default.nix rename hosts/adrastea/{home-manager-overrides.nix => home-manager-extras/default.nix} (100%) create mode 100755 hosts/phobos/configuration.nix mode change 100755 => 100644 hosts/phobos/default.nix diff --git a/flake.nix b/flake.nix index cd73b13..a39d976 100755 --- a/flake.nix +++ b/flake.nix @@ -69,7 +69,12 @@ apple-silicon, ... } @ inputs: rec { - formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra; + formatter = with nixpkgs.legacyPackages; { + x86_64-linux = x86_64-linux.alejandra; + aarch64-linux = aarch64-linux.alejandra; + aarch64-darwin = aarch64-darwin.alejandra; + }; + nixosConfigurations = { demeter = nixpkgs.lib.nixosSystem { specialArgs = {inherit inputs;}; @@ -91,66 +96,13 @@ system = "x86_64-linux"; modules = [ ./hosts/adrastea - ./modules/nixos/gaming - ./modules/nixos/audio - ./modules/nixos/networking - ./modules/nixos/fonts - ./modules/nixos/greeter - ./modules/nixos/core - ./overlays - - catppuccin.nixosModules.catppuccin - lix-module.nixosModules.default - # lanzaboote.nixosModules.lanzaboote - home-manager.nixosModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.backupFileExtension = "backup"; - home-manager.users.youwen = { - imports = [ - ./users/youwen/linux/laptop - ./users/youwen/linux/packages/x86_64 - ./users/youwen/linux/programs - ./users/youwen/common/neovim - ./users/youwen/common - ./users/youwen/common/neofetch - ./hosts/adrastea/home-manager-overrides.nix - inputs.catppuccin.homeManagerModules.catppuccin - inputs.nixvim.homeManagerModules.nixvim - ]; - }; - } ]; }; }; - formatter.aarch64-darwin = nixpkgs.legacyPackages.aarch64-darwin.alejandra; - formatter.aarch64-linux = nixpkgs.legacyPackages.aarch64-linux.alejandra; - # Build darwin flake using: - # $ darwin-rebuild build --flake .#Youwens-MacBook-Pro darwinConfigurations.phobos = nix-darwin.lib.darwinSystem { specialArgs = {inherit inputs;}; modules = [ ./hosts/phobos - home-manager.darwinModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.youwen.imports = [ - ./users/youwen/darwin/darwin-home.nix - ./users/youwen/common/core.nix - ./users/youwen/common/neofetch - ./users/youwen/common/neovim - ]; - home-manager.backupFileExtension = "backup"; - - # Optionally, use home-manager.extraSpecialArgs to pass - # arguments to home.nix - } - nix-homebrew.darwinModules.nix-homebrew - ./modules/darwin/homebrew.nix - ./modules/darwin/yabai.nix - ./modules/darwin/skhd.nix ]; }; }; diff --git a/hosts/adrastea/configuration.nix b/hosts/adrastea/configuration.nix new file mode 100755 index 0000000..be473ef --- /dev/null +++ b/hosts/adrastea/configuration.nix @@ -0,0 +1,227 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). +{ + config, + inputs, + pkgs, + lib, + ... +}: { + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # Bootloader. + boot.loader = { + efi.canTouchEfiVariables = true; + timeout = 15; + # Lanzaboote currently replaces the systemd-boot module. + # This setting is usually set to true in configuration.nix + # generated at installation time. So we force it to false + # for now. + systemd-boot = { + enable = true; + consoleMode = "auto"; + }; + }; + + # boot.lanzaboote = { + # enable = false; + # pkiBundle = "/etc/secureboot"; + # }; + + services.keyd = { + enable = true; + keyboards = { + default = { + ids = ["*"]; + settings = { + main = { + capslock = "esc"; + leftalt = "leftcontrol"; + leftcontrol = "leftalt"; + }; + }; + }; + }; + }; + + boot.initrd.luks.devices."luks-52d1be6d-b32f-41e0-a6d7-2ff52599fe7c".device = "/dev/disk/by-uuid/52d1be6d-b32f-41e0-a6d7-2ff52599fe7c"; + + services.tlp.enable = true; + + networking.hostName = "adrastea"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # select kernel + boot.kernelPackages = pkgs.linuxPackages_zen; + + # 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. + time.timeZone = "America/Los_Angeles"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + + systemd.services = {NetworkManager-wait-online.enable = false;}; + + # Enable the X11 windowing system. + # You can disable this if you're only using the Wayland session. + services.xserver.enable = false; + + programs.nix-ld = { + enable = true; + libraries = with pkgs; [icu xorg.libXtst xorg.libXi]; + }; + + hardware.nvidia = { + modesetting.enable = true; + powerManagement.enable = true; + powerManagement.finegrained = false; + open = false; + nvidiaSettings = true; + prime = { + amdgpuBusId = "PCI:4:0:0"; + nvidiaBusId = "PCI:1:0:0"; + offload = { + enable = true; + enableOffloadCmd = true; + }; + }; + }; + + hardware.graphics.enable = true; + + hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable; + + services.xserver.videoDrivers = ["nvidia"]; + + # services.desktopManager.plasma6.enable = true; + + # Configure keymap in X11 + services.xserver = { + xkb.layout = "us"; + xkb.variant = ""; + }; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.youwen = { + isNormalUser = true; + description = "Youwen Wu"; + extraGroups = ["networkmanager" "wheel" "nixos" "realtime"]; + }; + + users.groups.realtime = {}; + + nix.settings = { + trusted-users = ["root" "youwen"]; + experimental-features = ["nix-command" "flakes"]; + }; + + services.udev.extraRules = '' + KERNEL=="cpu_dma_latency", GROUP="realtime" + ''; + + security.pam.loginLimits = [ + { + domain = "@realtime"; + type = "-"; + item = "rtprio"; + value = 98; + } + { + domain = "@realtime"; + type = "-"; + item = "memlock"; + value = "unlimited"; + } + { + domain = "@realtime"; + type = "-"; + item = "nice"; + value = -11; + } + ]; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + neovim + wget + git + curl + librewolf + gnumake + gcc + cachix + gnupg + openssh + python3 + steam-run + + # deps for neovim compilation + lua51Packages.lua + lua51Packages.luarocks + tree-sitter + ]; + + environment.variables = { + EDITOR = "nvim"; + NIX_AUTO_RUN = 1; + }; + + # tells electron apps to use Wayland + environment.sessionVariables.NIXOS_OZONE_WL = "1"; + + # 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; + }; + + programs.dconf.enable = true; + + programs.hyprland.enable = true; + + programs.zsh.enable = false; + programs.fish.enable = true; + users.users.youwen.shell = pkgs.fish; + # 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 = "24.05"; # Did you read the comment? +} diff --git a/hosts/adrastea/default.nix b/hosts/adrastea/default.nix old mode 100755 new mode 100644 index be473ef..f7c9779 --- a/hosts/adrastea/default.nix +++ b/hosts/adrastea/default.nix @@ -1,227 +1,35 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). -{ - config, - inputs, - pkgs, - lib, - ... -}: { - imports = [ - # Include the results of the hardware scan. - ./hardware-configuration.nix - ]; +{inputs, ...}: { + imports = with inputs; [ + ./configuration.nix + ../../modules/nixos/gaming + ../../modules/nixos/audio + ../../modules/nixos/networking + ../../modules/nixos/fonts + ../../modules/nixos/greeter + ../../modules/nixos/core + ../../overlays - # Bootloader. - boot.loader = { - efi.canTouchEfiVariables = true; - timeout = 15; - # Lanzaboote currently replaces the systemd-boot module. - # This setting is usually set to true in configuration.nix - # generated at installation time. So we force it to false - # for now. - systemd-boot = { - enable = true; - consoleMode = "auto"; - }; - }; - - # boot.lanzaboote = { - # enable = false; - # pkiBundle = "/etc/secureboot"; - # }; - - services.keyd = { - enable = true; - keyboards = { - default = { - ids = ["*"]; - settings = { - main = { - capslock = "esc"; - leftalt = "leftcontrol"; - leftcontrol = "leftalt"; - }; - }; + catppuccin.nixosModules.catppuccin + lix-module.nixosModules.default + # lanzaboote.nixosModules.lanzaboote + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.backupFileExtension = "backup"; + home-manager.users.youwen = { + imports = [ + ./home-manager-extras + ../../users/youwen/linux/laptop + ../../users/youwen/linux/packages/x86_64 + ../../users/youwen/linux/programs + ../../users/youwen/common/neovim + ../../users/youwen/common + ../../users/youwen/common/neofetch + inputs.catppuccin.homeManagerModules.catppuccin + inputs.nixvim.homeManagerModules.nixvim + ]; }; - }; - }; - - boot.initrd.luks.devices."luks-52d1be6d-b32f-41e0-a6d7-2ff52599fe7c".device = "/dev/disk/by-uuid/52d1be6d-b32f-41e0-a6d7-2ff52599fe7c"; - - services.tlp.enable = true; - - networking.hostName = "adrastea"; # Define your hostname. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - # select kernel - boot.kernelPackages = pkgs.linuxPackages_zen; - - # 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. - time.timeZone = "America/Los_Angeles"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "en_US.UTF-8"; - LC_IDENTIFICATION = "en_US.UTF-8"; - LC_MEASUREMENT = "en_US.UTF-8"; - LC_MONETARY = "en_US.UTF-8"; - LC_NAME = "en_US.UTF-8"; - LC_NUMERIC = "en_US.UTF-8"; - LC_PAPER = "en_US.UTF-8"; - LC_TELEPHONE = "en_US.UTF-8"; - LC_TIME = "en_US.UTF-8"; - }; - - systemd.services = {NetworkManager-wait-online.enable = false;}; - - # Enable the X11 windowing system. - # You can disable this if you're only using the Wayland session. - services.xserver.enable = false; - - programs.nix-ld = { - enable = true; - libraries = with pkgs; [icu xorg.libXtst xorg.libXi]; - }; - - hardware.nvidia = { - modesetting.enable = true; - powerManagement.enable = true; - powerManagement.finegrained = false; - open = false; - nvidiaSettings = true; - prime = { - amdgpuBusId = "PCI:4:0:0"; - nvidiaBusId = "PCI:1:0:0"; - offload = { - enable = true; - enableOffloadCmd = true; - }; - }; - }; - - hardware.graphics.enable = true; - - hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable; - - services.xserver.videoDrivers = ["nvidia"]; - - # services.desktopManager.plasma6.enable = true; - - # Configure keymap in X11 - services.xserver = { - xkb.layout = "us"; - xkb.variant = ""; - }; - - # Enable CUPS to print documents. - services.printing.enable = true; - - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.youwen = { - isNormalUser = true; - description = "Youwen Wu"; - extraGroups = ["networkmanager" "wheel" "nixos" "realtime"]; - }; - - users.groups.realtime = {}; - - nix.settings = { - trusted-users = ["root" "youwen"]; - experimental-features = ["nix-command" "flakes"]; - }; - - services.udev.extraRules = '' - KERNEL=="cpu_dma_latency", GROUP="realtime" - ''; - - security.pam.loginLimits = [ - { - domain = "@realtime"; - type = "-"; - item = "rtprio"; - value = 98; - } - { - domain = "@realtime"; - type = "-"; - item = "memlock"; - value = "unlimited"; - } - { - domain = "@realtime"; - type = "-"; - item = "nice"; - value = -11; } ]; - - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - neovim - wget - git - curl - librewolf - gnumake - gcc - cachix - gnupg - openssh - python3 - steam-run - - # deps for neovim compilation - lua51Packages.lua - lua51Packages.luarocks - tree-sitter - ]; - - environment.variables = { - EDITOR = "nvim"; - NIX_AUTO_RUN = 1; - }; - - # tells electron apps to use Wayland - environment.sessionVariables.NIXOS_OZONE_WL = "1"; - - # 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; - }; - - programs.dconf.enable = true; - - programs.hyprland.enable = true; - - programs.zsh.enable = false; - programs.fish.enable = true; - users.users.youwen.shell = pkgs.fish; - # 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 = "24.05"; # Did you read the comment? } diff --git a/hosts/adrastea/home-manager-overrides.nix b/hosts/adrastea/home-manager-extras/default.nix similarity index 100% rename from hosts/adrastea/home-manager-overrides.nix rename to hosts/adrastea/home-manager-extras/default.nix diff --git a/hosts/phobos/configuration.nix b/hosts/phobos/configuration.nix new file mode 100755 index 0000000..c17278e --- /dev/null +++ b/hosts/phobos/configuration.nix @@ -0,0 +1,57 @@ +{ + inputs, + config, + pkgs, + ... +}: { + # Expose the package set, including overlays, for convenience. + # darwinPackages = inputs.self.darwinConfigurations."Youwens-MacBook-Pro".pkgs; + + # List packages installed in system profile. To search by name, run: + # $ nix-env -qaP | grep wget + environment.systemPackages = with pkgs; []; + + # Use a custom configuration.nix location. + # $ darwin-rebuild switch -I darwin-config=$HOME/.config/nixpkgs/darwin/configuration.nix + # environment.darwinConfig = "$HOME/.config/nixpkgs/darwin/configuration.nix"; + + # Auto upgrade nix package and the daemon service. + services.nix-daemon.enable = true; + # nix.package = pkgs.nix; + + nix.settings.experimental-features = "nix-command flakes"; + + nixpkgs.config.allowUnfree = true; + + # Create /etc/zshrc that loads the nix-darwin environment. + programs.zsh.enable = true; # default shell on catalina + programs.fish.enable = true; + programs.bash.enable = true; + + system.configurationRevision = + config.self.rev or config.self.dirtyRev or null; + + nixpkgs.hostPlatform = "aarch64-darwin"; + + # Used for backwards compatibility, please read the changelog before changing. + # $ darwin-rebuild changelog + system.stateVersion = 4; + + users.users.youwen = { + home = "/Users/youwen"; + description = "Youwen Wu"; + shell = pkgs.fish; + }; + + security.pam.enableSudoTouchIdAuth = true; + + fonts = { + packages = with pkgs; [ + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + (nerdfonts.override {fonts = ["CascadiaCode"];}) + (google-fonts.override {fonts = ["Lora"];}) + ]; + }; +} diff --git a/hosts/phobos/default.nix b/hosts/phobos/default.nix old mode 100755 new mode 100644 index c17278e..c968d8d --- a/hosts/phobos/default.nix +++ b/hosts/phobos/default.nix @@ -1,57 +1,22 @@ -{ - inputs, - config, - pkgs, - ... -}: { - # Expose the package set, including overlays, for convenience. - # darwinPackages = inputs.self.darwinConfigurations."Youwens-MacBook-Pro".pkgs; - - # List packages installed in system profile. To search by name, run: - # $ nix-env -qaP | grep wget - environment.systemPackages = with pkgs; []; - - # Use a custom configuration.nix location. - # $ darwin-rebuild switch -I darwin-config=$HOME/.config/nixpkgs/darwin/configuration.nix - # environment.darwinConfig = "$HOME/.config/nixpkgs/darwin/configuration.nix"; - - # Auto upgrade nix package and the daemon service. - services.nix-daemon.enable = true; - # nix.package = pkgs.nix; - - nix.settings.experimental-features = "nix-command flakes"; - - nixpkgs.config.allowUnfree = true; - - # Create /etc/zshrc that loads the nix-darwin environment. - programs.zsh.enable = true; # default shell on catalina - programs.fish.enable = true; - programs.bash.enable = true; - - system.configurationRevision = - config.self.rev or config.self.dirtyRev or null; - - nixpkgs.hostPlatform = "aarch64-darwin"; - - # Used for backwards compatibility, please read the changelog before changing. - # $ darwin-rebuild changelog - system.stateVersion = 4; - - users.users.youwen = { - home = "/Users/youwen"; - description = "Youwen Wu"; - shell = pkgs.fish; - }; - - security.pam.enableSudoTouchIdAuth = true; - - fonts = { - packages = with pkgs; [ - noto-fonts - noto-fonts-cjk - noto-fonts-emoji - (nerdfonts.override {fonts = ["CascadiaCode"];}) - (google-fonts.override {fonts = ["Lora"];}) - ]; - }; +{inputs, ...}: { + imports = with inputs; [ + ./configuration.nix + home-manager.darwinModules.home-manager + { + extraSpecialArgs = {inherit inputs;}; + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.youwen.imports = [ + ../../users/youwen/darwin/darwin-home.nix + ../../users/youwen/common/core.nix + ../../users/youwen/common/neofetch + ../../users/youwen/common/neovim + ]; + home-manager.backupFileExtension = "backup"; + } + nix-homebrew.darwinModules.nix-homebrew + ../../modules/darwin/homebrew.nix + ../../modules/darwin/yabai.nix + ../../modules/darwin/skhd.nix + ]; } From 569a389fa918e720f409cb109a5590e314b895a0 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Wed, 21 Aug 2024 00:24:47 -0700 Subject: [PATCH 6/8] fix: temporarily pin hyprland to stable to avoid mesa bugs --- flake.lock | 17 +++++++++++++++++ flake.nix | 7 ++++++- hosts/demeter/default.nix | 14 +++++++++++--- users/youwen/linux/hyprland/common.nix | 8 +++++++- 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/flake.lock b/flake.lock index 3386095..0ff80d5 100755 --- a/flake.lock +++ b/flake.lock @@ -433,6 +433,22 @@ "type": "github" } }, + "hyprland-stable": { + "locked": { + "lastModified": 1723474844, + "narHash": "sha256-9dyLWfx/PruwHjCZhIvY3jBdNfhID1AbsSU6Wkn284k=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "6404fe89d602c9511c08f4978bcb214032cd3cfc", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "6404fe89d602c9511c08f4978bcb214032cd3cfc", + "type": "github" + } + }, "lanzaboote": { "inputs": { "crane": "crane", @@ -721,6 +737,7 @@ "home-manager": "home-manager", "homebrew-cask": "homebrew-cask", "homebrew-core": "homebrew-core", + "hyprland-stable": "hyprland-stable", "lanzaboote": "lanzaboote", "lix-module": "lix-module", "nix-darwin": "nix-darwin", diff --git a/flake.nix b/flake.nix index a39d976..82fe25d 100755 --- a/flake.nix +++ b/flake.nix @@ -53,6 +53,8 @@ url = "github:nix-community/nixvim"; inputs.nixpkgs.follows = "nixpkgs"; }; + + hyprland-stable.url = "github:nixos/nixpkgs/6404fe89d602c9511c08f4978bcb214032cd3cfc"; }; outputs = { @@ -77,8 +79,11 @@ nixosConfigurations = { demeter = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs;}; system = "x86_64-linux"; + specialArgs = { + inherit inputs; + system = "x86_64-linux"; + }; modules = [ ./hosts/demeter ]; diff --git a/hosts/demeter/default.nix b/hosts/demeter/default.nix index 109f20b..dddff51 100644 --- a/hosts/demeter/default.nix +++ b/hosts/demeter/default.nix @@ -1,4 +1,8 @@ -{inputs, ...}: { +{ + inputs, + system, + ... +}: { imports = with inputs; [ ./configuration.nix ../../modules/nixos/gaming @@ -17,6 +21,10 @@ home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.backupFileExtension = "backup"; + home-manager.extraSpecialArgs = { + inherit inputs; + inherit system; + }; home-manager.users.youwen = { imports = [ ../../users/youwen/linux/desktop @@ -25,8 +33,8 @@ ../../users/youwen/common/neofetch ../../users/youwen/common/neovim ../../users/youwen/common - inputs.catppuccin.homeManagerModules.catppuccin - inputs.nixvim.homeManagerModules.nixvim + catppuccin.homeManagerModules.catppuccin + nixvim.homeManagerModules.nixvim ]; }; } diff --git a/users/youwen/linux/hyprland/common.nix b/users/youwen/linux/hyprland/common.nix index c0facf2..8cbd1f2 100644 --- a/users/youwen/linux/hyprland/common.nix +++ b/users/youwen/linux/hyprland/common.nix @@ -1,6 +1,12 @@ -{pkgs, ...}: { +{ + pkgs, + inputs, + system, + ... +}: { wayland.windowManager.hyprland = { enable = true; + package = inputs.hyprland-stable.legacyPackages.${system}.hyprland; settings = { exec-once = ["waypaper --restore"]; "$mod" = "SUPER"; From 847e8a94f7a9c6dff8ff0369588bb0ead6ee146d Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Wed, 21 Aug 2024 03:44:33 -0700 Subject: [PATCH 7/8] feat: use nvim as kitty scrollback pager --- users/youwen/linux/programs/default.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/users/youwen/linux/programs/default.nix b/users/youwen/linux/programs/default.nix index 15dd19a..73f7b67 100644 --- a/users/youwen/linux/programs/default.nix +++ b/users/youwen/linux/programs/default.nix @@ -12,11 +12,13 @@ background_opacity = "0.8"; allow_remote_control = "socket-only"; listen_on = "unix:/tmp/kitty"; - action_alias = "kitty_scrollback_nvim kitten /home/youwen/.local/share/nvim/lazy/kitty-scrollback.nvim/python/kitty_scrollback_nvim.py"; + # action_alias = "kitty_scrollback_nvim kitten /home/youwen/.local/share/nvim/lazy/kitty-scrollback.nvim/python/kitty_scrollback_nvim.py"; + scrollback_pager = ''nvim --noplugin -c "set signcolumn=no showtabline=0" -c "silent write! /tmp/kitty_scrollback_buffer | te cat /tmp/kitty_scrollback_buffer - "''; }; keybindings = { - "kitty_mod+h" = "kitty_scrollback_nvim"; - "kitty_mod+g" = "kitty_scrollback_nvim --config ksb_builtin_last_cmd_output"; + # "kitty_mod+h" = "kitty_scrollback_nvim"; + # "kitty_mod+g" = "kitty_scrollback_nvim --config ksb_builtin_last_cmd_output"; + "kitty_mod+h" = "show_scrollback"; }; }; From cc9ac29ab4a805b456de556967001db7ce59029c Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Wed, 21 Aug 2024 14:08:50 -0700 Subject: [PATCH 8/8] chore: pin to stable instead of specific hyprland commit --- flake.nix | 2 -- users/youwen/linux/hyprland/common.nix | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 82fe25d..b782c86 100755 --- a/flake.nix +++ b/flake.nix @@ -53,8 +53,6 @@ url = "github:nix-community/nixvim"; inputs.nixpkgs.follows = "nixpkgs"; }; - - hyprland-stable.url = "github:nixos/nixpkgs/6404fe89d602c9511c08f4978bcb214032cd3cfc"; }; outputs = { diff --git a/users/youwen/linux/hyprland/common.nix b/users/youwen/linux/hyprland/common.nix index 8cbd1f2..2cce905 100644 --- a/users/youwen/linux/hyprland/common.nix +++ b/users/youwen/linux/hyprland/common.nix @@ -6,7 +6,7 @@ }: { wayland.windowManager.hyprland = { enable = true; - package = inputs.hyprland-stable.legacyPackages.${system}.hyprland; + package = inputs.stablepkgs.legacyPackages.${system}.hyprland; settings = { exec-once = ["waypaper --restore"]; "$mod" = "SUPER";