diff --git a/.gitignore b/.gitignore index bf7b720..6c88fda 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ .\#* /.direnv /.pre-commit-config.yaml +nixos.qcow2 result diff --git a/common/globals.nix b/common/globals.nix new file mode 100644 index 0000000..e368a69 --- /dev/null +++ b/common/globals.nix @@ -0,0 +1,15 @@ +{ + keyboard.layout = "us"; + keyboard.variant = "colemak"; + + language = "en_US.UTF-8"; + + sshkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBx1z962nl87rmOk/vw3EBSgqU/VlCqON8zTeLHQcSBp willem@zeus"; + + zsh.prompt = "\n%B%F{cyan}%m:%F{blue}%~\n%F{green}$ %f%"; + zsh.rprompt = "%B%F{red}%*%f%b"; + + timezone = "America/Vancouver"; + + username = "willem"; +} diff --git a/common/system.nix b/common/system.nix new file mode 100644 index 0000000..df10513 --- /dev/null +++ b/common/system.nix @@ -0,0 +1,44 @@ +{ + pkgs, + lib, + globals, + ... +}: { + environment.pathsToLink = ["/share/zsh"]; + environment.shells = [pkgs.bashInteractive pkgs.zsh]; + environment.systemPackages = [pkgs.coreutils pkgs.git]; + environment.variables.LANG = "en_US.UTF-8"; + environment.variables.LANGUAGE = "en_US.UTF-8"; + environment.variables.LC_ALL = "en_US.UTF-8"; + environment.variables.LC_CTYPE = "en_US.UTF-8"; + environment.variables.SHELL = "${pkgs.zsh}/bin/zsh"; + + nix = { + package = pkgs.nix; + settings.experimental-features = ["nix-command" "flakes" "repl-flake"]; + settings.trusted-users = ["root" "willem"]; + }; + + programs.nix-index.enable = false; + + programs.bash.enableCompletion = true; + programs.bash.interactiveShellInit = '' + export PS1=$'\n'"\e[0mbash: \e[34;1m\w"$'\n'"\e[32m\\$\e[0m " + ''; + + documentation.enable = true; + documentation.man.enable = true; + + programs.zsh.enable = true; + programs.zsh.shellInit = lib.mkDefault "zsh-newuser-install() { :; }"; + programs.zsh.enableBashCompletion = true; + programs.zsh.promptInit = lib.mkDefault '' + autoload -U promptinit && promptinit + export PROMPT="${globals.zsh.prompt}" + export RPROMPT="${globals.zsh.rprompt}" + ''; + + time.timeZone = globals.timezone; + + users.users.willem.shell = pkgs.zsh; +} diff --git a/flake-parts/apps.nix b/flake-parts/apps.nix deleted file mode 100644 index 449828f..0000000 --- a/flake-parts/apps.nix +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) 2018 Terje Larsen -# This work is licensed under the terms of the MIT license. -# For a copy, see https://opensource.org/licenses/MIT. -# https://github.com/terlar/nix-config/blob/00c8a3622e8bc4cb522bbf335e6ede04ca07da40/flake-parts/apps.nix -{lib, ...}: { - perSystem = {pkgs, ...}: - lib.pipe ../apps [ - lib.filesystem.listFilesRecursive - (map (file: pkgs.callPackage file {})) - (map (drv: { - apps.${drv.name} = { - type = "app"; - program = lib.getExe drv; - }; - checks."app-${drv.name}" = drv; - })) - (lib.fold lib.recursiveUpdate {}) - ]; -} diff --git a/flake-parts/default.nix b/flake-parts/default.nix deleted file mode 100644 index 02166c8..0000000 --- a/flake-parts/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ - imports = [ - ./apps.nix - ./home-manager - ./lib - ./nixos - ./overlays.nix - ./packages.nix - ]; -} diff --git a/flake-parts/home-manager/configurations.nix b/flake-parts/home-manager/configurations.nix deleted file mode 100644 index 6a99aea..0000000 --- a/flake-parts/home-manager/configurations.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ - lib, - flake-parts-lib, - self, - ... -}: let - inherit (lib) mkOption types; - inherit (flake-parts-lib) mkTransposedPerSystemModule; -in - mkTransposedPerSystemModule - { - name = "homeConfigurations"; - file = ./configurations.nix; - option = mkOption { - type = types.lazyAttrsOf types.unspecified; - default = {}; - description = "Home Manager user configurations."; - }; - } diff --git a/flake-parts/home-manager/modules.nix b/flake-parts/home-manager/modules.nix deleted file mode 100644 index 1c4e660..0000000 --- a/flake-parts/home-manager/modules.nix +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (c) 2018 Terje Larsen -# This work is licensed under the terms of the MIT license. -# For a copy, see https://opensource.org/licenses/MIT. -# https://github.com/terlar/nix-config/blob/00c8a3622e8bc4cb522bbf335e6ede04ca07da40/flake-parts/home-manager/modules.nix -{ - lib, - self, - inputs, - ... -}: { - flake.homeManagerModules = let - modules = self.lib.importDirToAttrs ../../home-manager; - non-specific-modules = lib.filterAttrs (n: v: (!(lib.hasInfix "darwin" n) && !(lib.hasInfix "linux" n))) modules; - darwin-modules = lib.filterAttrs (n: v: (lib.hasInfix "darwin" n)) modules; - linux-modules = lib.filterAttrs (n: v: (lib.hasInfix "linux" n)) modules; - in - { - default = { - imports = builtins.attrValues non-specific-modules; - }; - - darwin = { - imports = builtins.attrValues darwin-modules; - }; - - linux = { - imports = builtins.attrValues linux-modules; - }; - - nixpkgs-config = { - nixpkgs.config.allowUnfreePredicate = _: true; - nixpkgs.config.allowUnsupportedSystem = true; - nixpkgs.overlays = builtins.attrValues self.overlays; - }; - - nixpkgs-useFlakeNixpkgs = { - home.sessionVariables.NIX_PATH = "nixpkgs=${inputs.nixpkgs}"; - nix.registry.nixpkgs.flake = inputs.nixpkgs; - }; - - hyprland = { - imports = [ - inputs.hyprland.homeManagerModules.default - {wayland.windowManager.hyprland.enable = true;} - ]; - }; - } - // modules; -} diff --git a/flake-parts/home-manager/users.nix b/flake-parts/home-manager/users.nix deleted file mode 100644 index 01f39d5..0000000 --- a/flake-parts/home-manager/users.nix +++ /dev/null @@ -1,68 +0,0 @@ -{ - inputs, - self, - lib, - ... -}: { - flake = { - homeManagerModules.user-willem = { - imports = [ - self.homeManagerModules.default - inputs.nix-index-database.hmModules.nix-index - ]; - - home.username = "willem"; - }; - - homeManagerModules.user-willem-darwin = { - imports = [ - self.homeManagerModules.darwin - self.homeManagerModules.user-willem - self.homeManagerModules.nixpkgs-config - self.homeManagerModules.nixpkgs-useFlakeNixpkgs - ]; - - programs.emacs.enableOrgTex = true; - - home.homeDirectory = "/Users/willem"; - }; - - homeManagerModules.user-willem-linux = { - imports = [ - self.homeManagerModules.user-willem - self.homeManagerModules.linux - inputs.hyprland.homeManagerModules.default - ]; - - programs.emacs.enableOrgTex = false; - - home.homeDirectory = "/home/willem"; - }; - }; - - perSystem = { - pkgs, - self', - system, - ... - }: rec { - homeConfigurations.willem = let - systemType = - if pkgs.stdenv.isDarwin - then "darwin" - else "linux"; - in - inputs.home-manager.lib.homeManagerConfiguration { - inherit pkgs; - modules = [self.homeManagerModules."user-willem-${systemType}" {nix.package = pkgs.nix;}]; - }; - - packages = let - activationPackages = builtins.mapAttrs (_: lib.getAttr "activationPackage") homeConfigurations; - in - lib.pipe activationPackages [ - (lib.filterAttrs (_: drv: pkgs.system == drv.system)) - (lib.mapAttrs' (username: lib.nameValuePair "home-${username}")) - ]; - }; -} diff --git a/flake-parts/lib/default.nix b/flake-parts/lib/default.nix deleted file mode 100644 index 1bd791b..0000000 --- a/flake-parts/lib/default.nix +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (c) 2018 Terje Larsen -# This work is licensed under the terms of the MIT license. -# For a copy, see https://opensource.org/licenses/MIT. -# https://github.com/terlar/nix-config/blob/00c8a3622e8bc4cb522bbf335e6ede04ca07da40/flake-parts/lib/default.nix -{ - self, - lib, - ... -}: { - flake.lib = { - kebabCaseToCamelCase = - builtins.replaceStrings (map (s: "-${s}") lib.lowerChars) lib.upperChars; - - importDirToAttrs = dir: - lib.pipe dir [ - lib.filesystem.listFilesRecursive - (builtins.filter (lib.hasSuffix ".nix")) - (map (path: { - name = lib.pipe path [ - toString - (lib.removePrefix "${toString dir}/") - (lib.removeSuffix "/default.nix") - (lib.removeSuffix ".nix") - self.lib.kebabCaseToCamelCase - (builtins.replaceStrings ["/"] ["-"]) - ]; - value = import path; - })) - builtins.listToAttrs - ]; - - mk-mac-binpkg = import ../../packages/mk-mac-binpkg.nix; - }; -} diff --git a/flake-parts/nixos/default.nix b/flake-parts/nixos/default.nix deleted file mode 100644 index 4680d73..0000000 --- a/flake-parts/nixos/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - imports = [ - ./hosts.nix - ./modules.nix - ]; -} diff --git a/flake-parts/nixos/hosts.nix b/flake-parts/nixos/hosts.nix deleted file mode 100644 index 9e08904..0000000 --- a/flake-parts/nixos/hosts.nix +++ /dev/null @@ -1,86 +0,0 @@ -{ - self, - inputs, - ... -}: { - flake = { - nixosModules.base = {...}: { - imports = [ - ../../nixos/profiles/common.nix - ../../nixos/profiles/linux/base.nix - self.nixosModules.useFlakeNixpkgs - self.nixosModules.users-willem - inputs.nix-index-database.nixosModules.nix-index - ]; - - nixpkgs.overlays = builtins.attrValues self.overlays; - nixpkgs.config.allowUnfree = true; - }; - - nixosModules.darwinArmVM = {...}: { - virtualisation.host.pkgs = inputs.nixpkgs.legacyPackages.aarch64-darwin; - }; - - nixosModules.willem-home = {...}: { - imports = [ - inputs.home-manager.nixosModules.home-manager - self.nixosModules.homeManagerIntegration - ]; - home-manager.users.willem = self.homeManagerModules.user-willem-linux; - }; - - darwinModules.base = {...}: { - imports = [ - ../../nixos/profiles/common.nix - self.nixosModules.linkNixInputs - self.nixosModules.useFlakeNixpkgs - ]; - - nixpkgs.overlays = builtins.attrValues self.overlays; - nixpkgs.config.allowUnfree = true; - }; - - nixosConfigurations.nixbox = inputs.nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - self.nixosModules.base - self.nixosModules.willem-home - self.nixosModules.hyprland - ../../nixos/hosts/nixbox.nix - ]; - - specialArgs = {inherit inputs;}; - }; - - nixosConfigurations.arm-live = inputs.nixpkgs.lib.nixosSystem { - system = "aarch64-linux"; - modules = [ - self.nixosModules.base - ../../nixos/hosts/live.nix - ]; - specialArgs = {inherit inputs;}; - }; - - nixosConfigurations.darwinArmMinimalVM = inputs.nixpkgs.lib.nixosSystem { - system = "aarch64-linux"; - modules = [ - self.nixosModules.users-willemVm - self.nixosModules.base - self.nixosModules.headlessVm - self.nixosModules.darwinArmVM - ]; - specialArgs = {inherit inputs;}; - }; - - darwinConfigurations.zeus = inputs.darwin.lib.darwinSystem { - system = "aarch64-darwin"; - modules = [ - self.darwinModules.base - ../../nixos/hosts/zeus.darwin.nix - ]; - specialArgs = {inherit inputs;}; - }; - - packages.aarch64-darwin.minimalVM = self.nixosConfigurations.darwinArmMinimalVM.config.system.build.vm; - }; -} diff --git a/flake-parts/nixos/modules.nix b/flake-parts/nixos/modules.nix deleted file mode 100644 index 42a02cc..0000000 --- a/flake-parts/nixos/modules.nix +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) 2018 Terje Larsen -# This work is licensed under the terms of the MIT license. -# For a copy, see https://opensource.org/licenses/MIT. -# https://github.com/terlar/nix-config/blob/00c8a3622e8bc4cb522bbf335e6ede04ca07da40/flake-parts/lib/default.nix -{ - self, - inputs, - ... -}: { - flake.nixosModules = let - modules = self.lib.importDirToAttrs ../../nixos/modules; - in - { - default = { - imports = builtins.attrValues modules; - }; - } - // modules; -} diff --git a/flake-parts/packages.nix b/flake-parts/packages.nix deleted file mode 100644 index c16a7dd..0000000 --- a/flake-parts/packages.nix +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright (c) 2018 Terje Larsen -# This work is licensed under the terms of the MIT license. -# For a copy, see https://opensource.org/licenses/MIT. -# https://github.com/terlar/nix-config/blob/00c8a3622e8bc4cb522bbf335e6ede04ca07da40/flake-parts/packages.nix -{ - self, - lib, - ... -}: { - perSystem = { - config, - pkgs, - ... - }: let - overlays = [ - self.overlays.default - ]; - pkgs' = pkgs.extend (lib.composeManyExtensions overlays); - in { - packages = { - inherit - (pkgs') - darwin-zsh-completions - iaito - org-auctex - pinentry-mac - pinentry-touchid - vkquake - ; - }; - - legacyPackages = { - wrapPackage = { - wrapper, - package, - exes ? [(lib.getExe package)], - }: let - wrapperExe = lib.getExe wrapper; - wrapExe = exe: - pkgs.writeShellScriptBin (builtins.baseNameOf exe) '' - exec ${wrapperExe} ${exe} "$@" - ''; - in - pkgs.symlinkJoin { - name = "${package.name}-${wrapper.name}"; - paths = (map wrapExe exes) ++ [package]; - }; - - wrapPackages = pkgsWrapperFn: pkgNames: final: prev: let - wrapper = pkgsWrapperFn final; - in - builtins.listToAttrs (map - (name: { - inherit name; - value = config.legacyPackages.wrapPackage { - inherit wrapper; - package = prev.${name}; - }; - }) - pkgNames); - }; - }; -} diff --git a/flake.nix b/flake.nix index 02cbe62..5117763 100644 --- a/flake.nix +++ b/flake.nix @@ -29,10 +29,21 @@ nix-index-database.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = inputs: + outputs = { + flake-parts, + home-manager, + nixpkgs, + pre-commit-hooks, + darwin, + self, + ... + } @ inputs: let + globals = import ./common/globals.nix; + in inputs.flake-parts.lib.mkFlake {inherit inputs;} { imports = [ - ./flake-parts + ./flake/home-manager.nix + ./flake/overlays.nix ]; systems = [ @@ -42,10 +53,55 @@ "aarch64-linux" ]; + flake = let + mkSystem = type: system: definition: (type { + inherit system; + specialArgs = { + inherit inputs globals; + overlays = self.overlays; + }; + modules = [definition]; + }); + + mkNixos = arch: (mkSystem nixpkgs.lib.nixosSystem "${arch}-linux"); + mkDarwin = arch: (mkSystem darwin.lib.darwinSystem "${arch}-darwin"); + + mkHome = system: config: (home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.${system}; + specialArgs = { + inherit globals inputs; + overlays = self.overlays; + }; + modules = [ + {nix.package = nixpkgs.legacyPackages.${system}.nix;} + config + ]; + }); + in rec { + nixosConfigurations.x86_64-live = mkNixos "x86_64" ./nixos/hosts/x86_64-live.nix; + nixosConfigurations.aarch64-live = mkNixos "aarch64" ./nixos/hosts/aarch64-live.nix; + + nixosConfigurations.nixbox = mkNixos "x86_64" ./nixos/hosts/nixbox.nix; + + nixosConfigurations.darwin-arm-minimal-vm = mkNixos "aarch64" ./nixos/hosts/vms/aarch64-darwin-host/minimal.nix; + nixosConfigurations.darwin-arm-homeconsole-vm = mkNixos "aarch64" ./nixos/hosts/vms/aarch64-darwin-host/home-console.nix; + + darwinConfigurations.zeus = mkDarwin "aarch64" ./nixos/hosts/zeus.nix; + + homeConfigurations.willem-darwin = mkHome "aarch64-darwin" ./home/darwin/default.nix; + homeConfigurations.willem-linux = mkHome "aarch64-linux" ./home/linux/default.nix; + + packages.aarch64-darwin.minimal-vm = self.nixosConfigurations.darwin-arm-minimal-vm.config.system.build.vm; + packages.aarch64-darwin.homeconsole-vm = self.nixosConfigurations.darwin-arm-homeconsole-vm.config.system.build.vm; + packages.x86_64-linux.live-image = self.nixosConfigurations.x86_64-live.config.system.build.isoImage; + packages.aarch64-linux.live-image = self.nixosConfigurations.x86_64-live.config.system.build.isoImage; + }; + perSystem = { system, self', pkgs, + lib, ... }: { checks.pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run { diff --git a/flake-parts/home-manager/default.nix b/flake/home-manager.nix similarity index 56% rename from flake-parts/home-manager/default.nix rename to flake/home-manager.nix index 1c84df2..084a755 100644 --- a/flake-parts/home-manager/default.nix +++ b/flake/home-manager.nix @@ -1,7 +1,3 @@ -# Copyright (c) 2018 Terje Larsen -# This work is licensed under the terms of the MIT license. -# For a copy, see https://opensource.org/licenses/MIT. -# https://github.com/terlar/nix-config/blob/00c8a3622e8bc4cb522bbf335e6ede04ca07da40/flake-parts/home-manager/default.nix { lib, flake-parts-lib, @@ -15,12 +11,10 @@ ; inherit (flake-parts-lib) mkSubmoduleOptions; in { - imports = [./configurations.nix ./modules.nix ./users.nix]; - options = { flake = mkSubmoduleOptions { homeManagerModules = mkOption { - type = types.lazyAttrsOf types.unspecified; + type = types.attrsOf types.unspecified; default = {}; apply = lib.mapAttrs (k: v: { _file = "${toString self.outPath}/flake.nix#homeManagerModules.${k}"; diff --git a/flake-parts/overlays.nix b/flake/overlays.nix similarity index 100% rename from flake-parts/overlays.nix rename to flake/overlays.nix diff --git a/home-manager/profiles/willem/linux/hyprland.conf b/home-manager/profiles/willem/linux/hyprland.conf deleted file mode 100644 index 5b86e0c..0000000 --- a/home-manager/profiles/willem/linux/hyprland.conf +++ /dev/null @@ -1,2 +0,0 @@ -$mainMod = SUPER -bind = $mainMod, Q, exec, kitty \ No newline at end of file diff --git a/home-manager/profiles/willem/darwin/base.nix b/home/darwin/default.nix similarity index 96% rename from home-manager/profiles/willem/darwin/base.nix rename to home/darwin/default.nix index 613eeed..7c685c5 100644 --- a/home-manager/profiles/willem/darwin/base.nix +++ b/home/darwin/default.nix @@ -4,6 +4,15 @@ lib, ... }: { + imports = [ + ../modules/nix/use-flake-pkgs.nix + ../modules/nix/pkgs-config.nix + ./finder.nix + ./iterm2.nix + ./keybinds.nix + ./launchd.nix + ]; + home.file.".gnupg/gpg-agent.conf" = { text = '' pinentry-program "${pkgs.pinentry-touchid}/bin/pinentry-touchid" diff --git a/home-manager/profiles/willem/darwin/finder.nix b/home/darwin/finder.nix similarity index 100% rename from home-manager/profiles/willem/darwin/finder.nix rename to home/darwin/finder.nix diff --git a/home-manager/profiles/willem/darwin/iterm2.nix b/home/darwin/iterm2.nix similarity index 100% rename from home-manager/profiles/willem/darwin/iterm2.nix rename to home/darwin/iterm2.nix diff --git a/home-manager/profiles/willem/darwin/keybinds.nix b/home/darwin/keybinds.nix similarity index 100% rename from home-manager/profiles/willem/darwin/keybinds.nix rename to home/darwin/keybinds.nix diff --git a/home-manager/profiles/willem/darwin/launchd.nix b/home/darwin/launchd.nix similarity index 100% rename from home-manager/profiles/willem/darwin/launchd.nix rename to home/darwin/launchd.nix diff --git a/home-manager/profiles/willem/base.nix b/home/default.nix similarity index 71% rename from home-manager/profiles/willem/base.nix rename to home/default.nix index bafc58b..49cee4b 100644 --- a/home-manager/profiles/willem/base.nix +++ b/home/default.nix @@ -1,20 +1,31 @@ { + inputs, + globals, config, - pkgs, - lib, ... }: let emacsCommand = "emacsclient -c -nw"; in rec { + imports = [ + ./modules/emacs.nix + ./packages.nix + ./programs/default.nix + ]; + home = { + username = globals.username; + stateVersion = "23.05"; + keyboard = { - layout = "us"; - variant = "colemak"; + layout = globals.keyboard.layout; + variant = globals.keyboard.variant; }; + language = { - base = "en_CA.UTF-8"; + base = globals.language; }; + sessionVariables = rec { DOTDIR = "${config.home.homeDirectory}/.config/dotfiles.nix"; EDITOR = emacsCommand; diff --git a/home-manager/profiles/willem/linux/base.nix b/home/linux/default.nix similarity index 57% rename from home-manager/profiles/willem/linux/base.nix rename to home/linux/default.nix index d234cd3..d3197d0 100644 --- a/home-manager/profiles/willem/linux/base.nix +++ b/home/linux/default.nix @@ -1,9 +1,16 @@ { config, pkgs, - lib, ... }: { + imports = [ + ../default.nix + ./services.nix + ./hyprland.nix + ../modules/nix/pkgs-config.nix + ../modules/nix/use-flake-pkgs.nix + ]; + programs.zsh.shellAliases = { nrs = "nixos-rebuild switch --flake ${config.home.homeDirectory}/.config/dotfiles.nix#"; nbs = "nixos-rebuild build --flake ${config.home.homeDirectory}/.config/dotfiles.nix#"; @@ -12,4 +19,8 @@ home.packages = with pkgs; [ gcc-arm-embedded ]; + + home.homeDirectory = "/home/willem"; + + programs.emacs.enableOrgTex = false; } diff --git a/home-manager/profiles/willem/linux/hyprland.nix b/home/linux/hyprland.nix similarity index 98% rename from home-manager/profiles/willem/linux/hyprland.nix rename to home/linux/hyprland.nix index a8e1f4f..ae2bfa3 100644 --- a/home-manager/profiles/willem/linux/hyprland.nix +++ b/home/linux/hyprland.nix @@ -6,7 +6,6 @@ }: { home.packages = with pkgs; [ alacritty - discord firefox lxappearance pipewire diff --git a/home-manager/profiles/willem/linux/services.nix b/home/linux/services.nix similarity index 100% rename from home-manager/profiles/willem/linux/services.nix rename to home/linux/services.nix diff --git a/home-manager/modules/emacs.nix b/home/modules/emacs.nix similarity index 100% rename from home-manager/modules/emacs.nix rename to home/modules/emacs.nix diff --git a/home/modules/nix/pkgs-config.nix b/home/modules/nix/pkgs-config.nix new file mode 100644 index 0000000..d217720 --- /dev/null +++ b/home/modules/nix/pkgs-config.nix @@ -0,0 +1,9 @@ +{ + self, + overlays, + ... +}: { + nixpkgs.config.allowUnfreePredicate = _: true; + nixpkgs.config.allowUnsupportedSystem = true; + nixpkgs.overlays = builtins.attrValues overlays; +} diff --git a/home/modules/nix/use-flake-pkgs.nix b/home/modules/nix/use-flake-pkgs.nix new file mode 100644 index 0000000..ae14175 --- /dev/null +++ b/home/modules/nix/use-flake-pkgs.nix @@ -0,0 +1,4 @@ +{inputs, ...}: { + home.sessionVariables.NIX_PATH = "nixpkgs=${inputs.nixpkgs}"; + nix.registry.nixpkgs.flake = inputs.nixpkgs; +} diff --git a/home-manager/profiles/willem/packages.nix b/home/packages.nix similarity index 100% rename from home-manager/profiles/willem/packages.nix rename to home/packages.nix diff --git a/home-manager/profiles/willem/programs/default.nix b/home/programs/default.nix similarity index 97% rename from home-manager/profiles/willem/programs/default.nix rename to home/programs/default.nix index 95a7dfc..d22df72 100644 --- a/home-manager/profiles/willem/programs/default.nix +++ b/home/programs/default.nix @@ -4,6 +4,11 @@ pkgs, ... }: { + imports = [ + ./zsh.nix + ./emacs + ]; + programs = { bash.enableCompletion = true; diff --git a/home-manager/profiles/willem/programs/emacs/default.nix b/home/programs/emacs/default.nix similarity index 100% rename from home-manager/profiles/willem/programs/emacs/default.nix rename to home/programs/emacs/default.nix diff --git a/home-manager/profiles/willem/programs/emacs/early-init.el b/home/programs/emacs/early-init.el similarity index 100% rename from home-manager/profiles/willem/programs/emacs/early-init.el rename to home/programs/emacs/early-init.el diff --git a/home-manager/profiles/willem/programs/emacs/init.el b/home/programs/emacs/init.el similarity index 100% rename from home-manager/profiles/willem/programs/emacs/init.el rename to home/programs/emacs/init.el diff --git a/home-manager/profiles/willem/programs/emacs/org-tex-cfg.el b/home/programs/emacs/org-tex-cfg.el similarity index 100% rename from home-manager/profiles/willem/programs/emacs/org-tex-cfg.el rename to home/programs/emacs/org-tex-cfg.el diff --git a/home-manager/profiles/willem/programs/emacs/tex.nix b/home/programs/emacs/tex.nix similarity index 100% rename from home-manager/profiles/willem/programs/emacs/tex.nix rename to home/programs/emacs/tex.nix diff --git a/home-manager/profiles/willem/programs/zsh.nix b/home/programs/zsh.nix similarity index 100% rename from home-manager/profiles/willem/programs/zsh.nix rename to home/programs/zsh.nix diff --git a/nixos/hosts/aarch64-live.nix b/nixos/hosts/aarch64-live.nix new file mode 100644 index 0000000..1d25a50 --- /dev/null +++ b/nixos/hosts/aarch64-live.nix @@ -0,0 +1,8 @@ +{inputs, ...}: { + imports = [ + ../profiles/live-image.nix + ../modules/apple-silicon.nix + ]; + + networking.hostName = "nixos-live-aarch64"; +} diff --git a/nixos/hosts/nixbox.nix b/nixos/hosts/nixbox.nix index 26de766..efbf7df 100644 --- a/nixos/hosts/nixbox.nix +++ b/nixos/hosts/nixbox.nix @@ -7,6 +7,9 @@ }: { imports = [ (modulesPath + "/installer/scan/not-detected.nix") + ../profiles/hyprland.nix + ../profiles/default.nix + ../modules/users/willem/home.nix ]; boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"]; diff --git a/nixos/hosts/vms/aarch64-darwin-host/home-console.nix b/nixos/hosts/vms/aarch64-darwin-host/home-console.nix new file mode 100644 index 0000000..9ecf653 --- /dev/null +++ b/nixos/hosts/vms/aarch64-darwin-host/home-console.nix @@ -0,0 +1,6 @@ +{...}: { + imports = [ + ../../../modules/users/willem/home.nix + ./minimal.nix + ]; +} diff --git a/nixos/hosts/vms/aarch64-darwin-host/minimal.nix b/nixos/hosts/vms/aarch64-darwin-host/minimal.nix new file mode 100644 index 0000000..969b2d1 --- /dev/null +++ b/nixos/hosts/vms/aarch64-darwin-host/minimal.nix @@ -0,0 +1,8 @@ +{...}: { + imports = [ + ../../../modules/users/willem/vm.nix + ../../../modules/vm/headless.nix + ../../../modules/vm/aarch64-darwin-host.nix + ../../../profiles/default.nix + ]; +} diff --git a/nixos/hosts/x86_64-live.nix b/nixos/hosts/x86_64-live.nix new file mode 100644 index 0000000..0f354c6 --- /dev/null +++ b/nixos/hosts/x86_64-live.nix @@ -0,0 +1,4 @@ +{ + imports = [../profiles/live-image.nix]; + networking.hostName = "nixos-live-x86_64"; +} diff --git a/nixos/hosts/zeus.darwin.nix b/nixos/hosts/zeus.nix similarity index 100% rename from nixos/hosts/zeus.darwin.nix rename to nixos/hosts/zeus.nix diff --git a/nixos/modules/appleSilicon.nix b/nixos/modules/apple-silicon.nix similarity index 100% rename from nixos/modules/appleSilicon.nix rename to nixos/modules/apple-silicon.nix diff --git a/nixos/modules/homeManagerIntegration.nix b/nixos/modules/hm-integration.nix similarity index 93% rename from nixos/modules/homeManagerIntegration.nix rename to nixos/modules/hm-integration.nix index eee08a6..8cbf578 100644 --- a/nixos/modules/homeManagerIntegration.nix +++ b/nixos/modules/hm-integration.nix @@ -1,4 +1,4 @@ -{ +{...}: { config.home-manager = { useGlobalPkgs = true; useUserPackages = true; diff --git a/nixos/modules/linkNixInputs.nix b/nixos/modules/nix/link-inputs.nix similarity index 100% rename from nixos/modules/linkNixInputs.nix rename to nixos/modules/nix/link-inputs.nix diff --git a/nixos/modules/useFlakeNixpkgs.nix b/nixos/modules/nix/use-flake-pkgs.nix similarity index 100% rename from nixos/modules/useFlakeNixpkgs.nix rename to nixos/modules/nix/use-flake-pkgs.nix diff --git a/nixos/modules/users/willem.nix b/nixos/modules/users/willem/default.nix similarity index 100% rename from nixos/modules/users/willem.nix rename to nixos/modules/users/willem/default.nix diff --git a/nixos/modules/users/willem/home.nix b/nixos/modules/users/willem/home.nix new file mode 100644 index 0000000..89c7415 --- /dev/null +++ b/nixos/modules/users/willem/home.nix @@ -0,0 +1,19 @@ +{ + inputs, + globals, + overlays, + ... +}: { + imports = [ + inputs.home-manager.nixosModules.home-manager + ]; + + home-manager.users.willem = { + imports = [ + inputs.nix-index-database.hmModules.nix-index + ../../../../home/linux/default.nix + ]; + }; + + home-manager.extraSpecialArgs = {inherit inputs overlays globals;}; +} diff --git a/nixos/modules/users/willem-vm.nix b/nixos/modules/users/willem/vm.nix similarity index 76% rename from nixos/modules/users/willem-vm.nix rename to nixos/modules/users/willem/vm.nix index 72607a1..88e4e8c 100644 --- a/nixos/modules/users/willem-vm.nix +++ b/nixos/modules/users/willem/vm.nix @@ -1,5 +1,5 @@ {...}: { - imports = [./willem.nix]; + imports = [./default.nix]; users.users.willem.hashedPassword = ""; services.getty.autologinUser = "willem"; } diff --git a/nixos/modules/vm/aarch64-darwin-host.nix b/nixos/modules/vm/aarch64-darwin-host.nix new file mode 100644 index 0000000..d8beead --- /dev/null +++ b/nixos/modules/vm/aarch64-darwin-host.nix @@ -0,0 +1,3 @@ +{inputs, ...}: { + virtualisation.host.pkgs = inputs.nixpkgs.legacyPackages.aarch64-darwin; +} diff --git a/nixos/modules/vm.nix b/nixos/modules/vm/default.nix similarity index 100% rename from nixos/modules/vm.nix rename to nixos/modules/vm/default.nix diff --git a/nixos/modules/headlessVm.nix b/nixos/modules/vm/headless.nix similarity index 78% rename from nixos/modules/headlessVm.nix rename to nixos/modules/vm/headless.nix index 922c16b..2e98ac6 100644 --- a/nixos/modules/headlessVm.nix +++ b/nixos/modules/vm/headless.nix @@ -1,5 +1,5 @@ {...}: { - imports = [./vm.nix]; + imports = [./default.nix]; virtualisation.vmVariant.virtualisation.graphics = false; virtualisation.graphics = false; } diff --git a/nixos/profiles/linux/base.nix b/nixos/profiles/default.nix similarity index 59% rename from nixos/profiles/linux/base.nix rename to nixos/profiles/default.nix index d99f03b..74a1c19 100644 --- a/nixos/profiles/linux/base.nix +++ b/nixos/profiles/default.nix @@ -1,5 +1,15 @@ -{pkgs, ...}: { - imports = [../common.nix]; +{ + inputs, + overlays, + pkgs, + ... +}: { + imports = [ + ../../common/system.nix + ../modules/nix/use-flake-pkgs.nix + ../modules/users/willem/default.nix + inputs.nix-index-database.nixosModules.nix-index + ]; console.keyMap = "colemak"; console.packages = [pkgs.terminus_font]; @@ -20,5 +30,8 @@ services.openssh.enable = true; - system.stateVersion = "23.11"; + system.stateVersion = "23.05"; + + nixpkgs.overlays = builtins.attrValues overlays; + nixpkgs.config.allowUnfree = true; } diff --git a/nixos/profiles/linux/desktop.nix b/nixos/profiles/desktop.nix similarity index 69% rename from nixos/profiles/linux/desktop.nix rename to nixos/profiles/desktop.nix index fd0fa9c..7e5d040 100644 --- a/nixos/profiles/linux/desktop.nix +++ b/nixos/profiles/desktop.nix @@ -1,10 +1,8 @@ -{pkgs, ...}: { - environment.systemPackages = with pkgs; [ - freecad - qbittorrent - vlc - ]; - +{ + pkgs, + globals, + ... +}: { services.pipewire = { enable = true; alsa.enable = true; @@ -19,11 +17,10 @@ security.rtkit.enable = true; services.xserver = { - enable = true; - layout = "us"; + layout = globals.keyboard.layout; libinput.mouse.naturalScrolling = true; libinput.touchpad.naturalScrolling = true; - xkbVariant = "colemak"; + xkbVariant = globals.keyboard.variant; }; sound.enable = true; diff --git a/nixos/profiles/linux/gnome.nix b/nixos/profiles/gnome.nix similarity index 95% rename from nixos/profiles/linux/gnome.nix rename to nixos/profiles/gnome.nix index 4d861e5..ec7400f 100644 --- a/nixos/profiles/linux/gnome.nix +++ b/nixos/profiles/gnome.nix @@ -8,7 +8,6 @@ ]) ++ (with pkgs.gnome; [ gnome-music - geary # email reader evince # document viewer gnome-characters totem # video player @@ -23,6 +22,7 @@ ]; services.xserver = { + enable = true; displayManager.gdm.enable = true; desktopManager.gnome.enable = true; }; diff --git a/nixos/modules/hyprland.nix b/nixos/profiles/hyprland.nix similarity index 65% rename from nixos/modules/hyprland.nix rename to nixos/profiles/hyprland.nix index e2e42c4..1b92bcb 100644 --- a/nixos/modules/hyprland.nix +++ b/nixos/profiles/hyprland.nix @@ -3,8 +3,16 @@ pkgs, ... }: { + imports = [./desktop.nix]; + + home-manager.sharedModules = [ + {wayland.windowManager.hyprland.enable = true;} + inputs.hyprland.homeManagerModules.default + ]; + programs.hyprland.enable = true; programs.hyprland.package = inputs.hyprland.packages.${pkgs.system}.hyprland; + nix.settings = { substituters = ["https://hyprland.cachix.org"]; trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="]; diff --git a/nixos/profiles/linux/hyprland.nix b/nixos/profiles/linux/hyprland.nix deleted file mode 100644 index e2e42c4..0000000 --- a/nixos/profiles/linux/hyprland.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ - inputs, - pkgs, - ... -}: { - programs.hyprland.enable = true; - programs.hyprland.package = inputs.hyprland.packages.${pkgs.system}.hyprland; - nix.settings = { - substituters = ["https://hyprland.cachix.org"]; - trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="]; - }; -} diff --git a/nixos/hosts/live.nix b/nixos/profiles/live-image.nix similarity index 96% rename from nixos/hosts/live.nix rename to nixos/profiles/live-image.nix index ea060f3..31d65eb 100644 --- a/nixos/hosts/live.nix +++ b/nixos/profiles/live-image.nix @@ -6,11 +6,11 @@ ... }: { imports = [ - (modulesPath + "/installer/cd-dvd/iso-image.nix") (modulesPath + "/profiles/minimal.nix") + (modulesPath + "/installer/cd-dvd/iso-image.nix") (modulesPath + "/profiles/installation-device.nix") + ./default.nix ]; - networking.hostName = "nixos-live"; environment.systemPackages = with pkgs; [ curl @@ -19,6 +19,7 @@ efivar fuse fuse3 + git gptfdisk hdparm ms-sys diff --git a/packages/iaito.nix b/packages/iaito.nix deleted file mode 100644 index 16875d0..0000000 --- a/packages/iaito.nix +++ /dev/null @@ -1,94 +0,0 @@ -{ - lib, - stdenv, - fetchFromGitHub, - meson, - ninja, - pkg-config, - python3, - qtbase, - qtsvg, - qttools, - radare2, - wrapQtAppsHook, -}: -stdenv.mkDerivation rec { - pname = "iaito"; - version = "5.8.4"; - - srcs = [ - (fetchFromGitHub rec { - owner = "radareorg"; - repo = "iaito"; - rev = version; - hash = "sha256-pt2vq+JN+Ccv+9o8s2y87xTVeQp2WJ0UfKdoWGsBkUI="; - name = repo; - }) - (fetchFromGitHub rec { - owner = "radareorg"; - repo = "iaito-translations"; - rev = "e66b3a962a7fc7dfd730764180011ecffbb206bf"; - hash = "sha256-6NRTZ/ydypsB5TwbivvwOH9TEMAff/LH69hCXTvMPp8="; - name = repo; - }) - ]; - sourceRoot = "iaito/src"; - - postUnpack = '' - chmod -R u+w iaito-translations - ''; - - postPatch = '' - substituteInPlace common/ResourcePaths.cpp \ - --replace "/app/share/iaito/translations" "$out/share/iaito/translations" - ''; - - nativeBuildInputs = [ - meson - ninja - pkg-config - python3 - qttools - wrapQtAppsHook - ]; - - buildInputs = [ - qtbase - qtsvg - radare2 - ]; - - postBuild = '' - pushd ../../../iaito-translations - make build PREFIX=$out - popd - ''; - - installPhase = '' - runHook preInstall - - install -m755 -Dt $out/bin iaito - install -m644 -Dt $out/share/metainfo ../org.radare.iaito.appdata.xml - install -m644 -Dt $out/share/applications ../org.radare.iaito.desktop - install -m644 -Dt $out/share/pixmaps ../img/iaito-o.svg - - pushd ../../../iaito-translations - make install PREFIX=$out -j$NIX_BUILD_CORES - popd - - runHook postInstall - ''; - - meta = with lib; { - description = "An official graphical interface of radare2"; - longDescription = '' - iaito is the official graphical interface of radare2. It's the - continuation of Cutter for radare2 after the Rizin fork. - ''; - homepage = "https://radare.org/n/iaito.html"; - changelog = "https://github.com/radareorg/iaito/releases/tag/${version}"; - license = licenses.gpl3Plus; - maintainers = with maintainers; [azahi]; - platforms = platforms.all; - }; -} diff --git a/packages/vkquake/default.nix b/packages/vkquake/default.nix deleted file mode 100644 index c99af79..0000000 --- a/packages/vkquake/default.nix +++ /dev/null @@ -1,61 +0,0 @@ -{ - pkgs, - fetchFromGitHub, - lib, - stdenv, - ... -}: -stdenv.mkDerivation { - pname = "vkquake"; - name = "vkQuake"; - - src = fetchFromGitHub { - owner = "Novum"; - repo = "vkQuake"; - rev = "98e9e1c76e4ea57d6960c8b4c67a72f7f50f45ea"; - sha256 = "sha256-XMsvc9886eYI+CzBMckop7WCAulm2qlKdNu+3qDK7zY="; - }; - - nativeBuildInputs = with pkgs; [ - meson - pkgconfig - python3 - cmake - ninja - darwin.binutils - ripgrep - ]; - - buildInputs = with pkgs; [ - vulkan-headers - glslang - spirv-tools - SDL2 - libvorbis - flac - libopus - opusfile - flac - libmad - darwin.moltenvk - ]; - - macApp = ./vkQuake.app; - - buildPhase = '' - # -*-sh-*- - cp -r $src/* . - meson build && ninja -C build - cp -r $macApp vkQuake.app - chmod -R a+rw vkQuake.app - ls - cp build/vkquake vkQuake.app/Contents/Resources/vkquake - ''; - - installPhase = '' - mkdir -p $out/bin - mkdir -p $out/Applications - mv build/vkquake $out/bin/vkquake - mv vkQuake.app $out/Applications/. - ''; -} diff --git a/packages/vkquake/vkQuake.app/Contents/Info.plist b/packages/vkquake/vkQuake.app/Contents/Info.plist deleted file mode 100755 index 56cf98b..0000000 --- a/packages/vkquake/vkQuake.app/Contents/Info.plist +++ /dev/null @@ -1,18 +0,0 @@ - - - - - CFBundleExecutable - q1-launcher.sh - CFBundleName - vkQuake - CFBundlePackageType - APPL - CFBundleIconFile - vkquake.icns - CFBundleShortVersionString - 5.00 - NSHumanReadableCopyright - id Software - - diff --git a/packages/vkquake/vkQuake.app/Contents/MacOS/q1-launcher.sh b/packages/vkquake/vkQuake.app/Contents/MacOS/q1-launcher.sh deleted file mode 100755 index 6b58529..0000000 --- a/packages/vkquake/vkQuake.app/Contents/MacOS/q1-launcher.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -# setting the right directories -BASEDIR="$( cd "$(dirname "$0")" || exit; pwd )" -RESOURCESDIR="$( cd "$BASEDIR/../Resources" || exit; pwd )" -FRAMEWORKSDIR="$( cd "$BASEDIR/../Frameworks" || exit; pwd )" - -BIN="$RESOURCESDIR/vkquake" - -export DYLD_FALLBACK_LIBRARY_PATH="$FRAMEWORKSDIR" - -QUAKEDIR="$(if [[ -e "$RESOURCESDIR/id1" ]]; then echo "$RESOURCESDIR"; else echo "$HOME/.baseq1"; fi)" - -$BIN -basedir $QUAKEDIR diff --git a/packages/vkquake/vkQuake.app/Contents/Resources/vkquake.icns b/packages/vkquake/vkQuake.app/Contents/Resources/vkquake.icns deleted file mode 100644 index 8bacbab..0000000 Binary files a/packages/vkquake/vkQuake.app/Contents/Resources/vkquake.icns and /dev/null differ