From 15c86c575f898a9f3f2ee9868d1dcddd16dde448 Mon Sep 17 00:00:00 2001 From: pegasust Date: Tue, 8 Nov 2022 12:14:47 -0700 Subject: [PATCH] feat: add nixgl which allows alacritty to be invoked for hwtr --- home-nix/flake.lock | 52 ++++++++++++++++++++++++++++++++++++++- home-nix/flake.nix | 48 +++++++++++++++++++++--------------- home-nix/home.nix | 18 ++++++++------ home-nix/hwtr/default.nix | 6 ----- home-nix/hwtr/nix.conf | 3 +++ 5 files changed, 92 insertions(+), 35 deletions(-) delete mode 100644 home-nix/hwtr/default.nix create mode 100644 home-nix/hwtr/nix.conf diff --git a/home-nix/flake.lock b/home-nix/flake.lock index bdcb8f8..397a9ec 100644 --- a/home-nix/flake.lock +++ b/home-nix/flake.lock @@ -15,6 +15,21 @@ "type": "github" } }, + "flake-utils_2": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -36,7 +51,41 @@ "type": "github" } }, + "nixgl": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1661367362, + "narHash": "sha256-Qc8MXcV+YCPREu8kk6oggk23ZBKLqeQRAIsLbHEviPE=", + "owner": "guibou", + "repo": "nixGL", + "rev": "7165ffbccbd2cf4379b6cd6d2edd1620a427e5ae", + "type": "github" + }, + "original": { + "owner": "guibou", + "repo": "nixGL", + "type": "github" + } + }, "nixpkgs": { + "locked": { + "lastModified": 1660551188, + "narHash": "sha256-a1LARMMYQ8DPx1BgoI/UN4bXe12hhZkCNqdxNi6uS0g=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "441dc5d512153039f19ef198e662e4f3dbb9fd65", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1667629849, "narHash": "sha256-P+v+nDOFWicM4wziFK9S/ajF2lc0N2Rg9p6Y35uMoZI=", @@ -56,7 +105,8 @@ "inputs": { "flake-utils": "flake-utils", "home-manager": "home-manager", - "nixpkgs": "nixpkgs" + "nixgl": "nixgl", + "nixpkgs": "nixpkgs_2" } }, "utils": { diff --git a/home-nix/flake.nix b/home-nix/flake.nix index 63c4f32..6760469 100644 --- a/home-nix/flake.nix +++ b/home-nix/flake.nix @@ -7,49 +7,57 @@ inputs.nixpkgs.follows = "nixpkgs"; }; flake-utils.url = "github:numtide/flake-utils"; + nixgl.url = "github:guibou/nixGL"; }; - outputs = { nixpkgs, home-manager, ... }: + outputs = { nixpkgs, home-manager, nixgl, ... }: let system = "x86_64-linux"; - pkgs = nixpkgs.legacyPackages.${system}; + pkgs = nixpkgs.legacyPackages.${system}.appendOverlays [nixgl.overlay]; in { homeConfigurations.nixos = home-manager.lib.homeManagerConfiguration { inherit pkgs; modules = [ ./home.nix - { - home = { - username = "nixos"; - homeDirectory = "/home/nixos"; - }; - } ]; + # optionally pass inarguments to module + # we migrate this from in-place modules to allow flexibility + # in this case, we can add "home" to input arglist of home.nix + extraSpecialArgs = { + myHome = { + username = "nixos"; + homeDirectory = "/home/nixos"; + }; + }; }; homeConfigurations.ubuntu_admin = home-manager.lib.homeManagerConfiguration { inherit pkgs; modules = [ ./home.nix - { - home = { - username = "ubuntu_admin"; - homeDirectory = "/home/ubuntu_admin"; - }; - } ]; + extraSpecialArgs = { + myHome = { + username = "ubuntu_admin"; + homeDirectory = "/home/ubuntu_admin"; + }; + }; }; homeConfigurations.hwtr = home-manager.lib.homeManagerConfiguration { inherit pkgs; modules = [ ./home.nix - { - home = { - username = "hwtr"; - homeDirectory = "/home/hwtr"; - }; - } ]; + extraSpecialArgs = { + myHome = { + username = "hwtr"; + homeDirectory = "/home/hwtr"; + packages = [pkgs.nixgl.nixGLIntel]; + shellAliases = { + nixGL = "nixGLIntel"; + }; + }; + }; }; }; } diff --git a/home-nix/home.nix b/home-nix/home.nix index 6053c0c..0e2ae5f 100644 --- a/home-nix/home.nix +++ b/home-nix/home.nix @@ -1,13 +1,15 @@ -{ config, pkgs,... }: +# myHome is injected from extraSpecialArgs in flake.nix +{ config, pkgs, myHome, ... }: { - home.username = "nixos"; - home.homeDirectory = "/home/nixos"; - + home = { + username = myHome.username; + homeDirectory = myHome.homeDirectory; + stateVersion = myHome.stateVersion or "22.05"; + }; home.packages = [ pkgs.htop pkgs.ripgrep pkgs.gcc pkgs.fd pkgs.zk pkgs.unzip pkgs.rustc pkgs.cargo pkgs.nodejs-18_x - ]; - home.stateVersion = "22.05"; + ] ++ (myHome.packages or []); nixpkgs.config.allowUnfree = true; ## Configs ## @@ -15,7 +17,7 @@ xdg.configFile."starship.toml".text = builtins.readFile ../starship/starship.toml; ## Programs ## - programs.alacritty = { + programs.alacritty = myHome.programs.alacritty or { enable = true; }; programs.direnv = { @@ -56,7 +58,7 @@ shellAliases = { nix-rebuild = "sudo nixos-rebuild switch"; hm-switch = "home-manager switch --flake"; - }; + } // (myHome.shellAliases or {}); history = { size = 10000; path = "${config.xdg.dataHome}/zsh/history"; diff --git a/home-nix/hwtr/default.nix b/home-nix/hwtr/default.nix deleted file mode 100644 index 8ea36b5..0000000 --- a/home-nix/hwtr/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ config, pkgs,... }@input: -{ - home.user = "hwtr"; - home.homeDirectory = "/home/hwtr"; - module = [./../common]; -} diff --git a/home-nix/hwtr/nix.conf b/home-nix/hwtr/nix.conf new file mode 100644 index 0000000..899ea7a --- /dev/null +++ b/home-nix/hwtr/nix.conf @@ -0,0 +1,3 @@ +accept-flake-config = true +experimental-features = nix-command flakes +