diff --git a/home/baseline.nix b/home/baseline.nix new file mode 100644 index 000000000..58edab6b5 --- /dev/null +++ b/home/baseline.nix @@ -0,0 +1,18 @@ +[ + ./profiles/core/default.nix + ./profiles/atuin.nix + ./profiles/development/nix-tools.nix + ./profiles/direnv.nix + ./profiles/fzf.nix + ./profiles/git/default.nix + ./profiles/helix.nix + ./profiles/navi.nix + ./profiles/nnn.nix + ./profiles/nvim/default.nix + ./profiles/rclone.nix + ./profiles/shells/zsh/default.nix + ./profiles/shells/zsh/with-grml.nix + ./profiles/ssh.nix + ./profiles/zellij.nix + ./profiles/zoxide.nix +] diff --git a/home/default.nix b/home/default.nix index fbb86c355..a84d2f4de 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,22 +1,53 @@ { - config, self, - ops, + inputs, + flake-parts-lib, + withSystem, ... }: let - inherit (self) inputs; - inherit (self.lib.hm) makeHomeConfiguration; - inherit (inputs.apparat.lib.hm) mkHomeConfigurations; + inherit (inputs) home-manager; + inherit (flake-parts-lib) importApply; - # features = import ./features.nix { homeProfiles = profiles; }; - profiles = import ./profiles.nix { inherit (inputs) haumea; }; + initUserModule = + { username }: + { lib, ... }: + { + # TODO: imports = [ ../users/${username}/identity.nix ]; + + home.username = username; + home.homeDirectory = lib.mkDefault "/home/${username}"; + }; + + initNixpkgsModule = importApply ../packages/nixpkgs-config.nix; + + makeHomeConfiguration = + username: system: + { + modules ? [ ], + overlays ? [ ], + allowUnfree ? false, + }: + (home-manager.lib.homeManagerConfiguration { + pkgs = withSystem system (ctx: ctx.pkgs); + modules = + modules + ++ (import ./modules-list.nix) + ++ (import ./baseline.nix) + ++ [ + (initUserModule { inherit username; }) + (initNixpkgsModule { inherit allowUnfree overlays; }) + ]; + extraSpecialArgs = self.lib.specialArgsFor system; + }); in { flake = { - # TODO: invert this approach -- make system configs import pre-defined home - # configs or something like that. see ~misterio77/nixos-config - homeConfigurations = (mkHomeConfigurations config.flake.nixosConfigurations); + homeConfigurations = { + "cdom@tuvok" = makeHomeConfiguration "cdom" "aarch64-linux" { + modules = [ ../users/cdom/at-tuvok.nix ]; + }; + }; homeModules = { "theme" = import ./modules/theme/default.nix; @@ -26,20 +57,4 @@ in "programs/liquidprompt" = import ./modules/programs/liquidprompt.nix; }; }; - - perSystem = _perSystem: { - homeConfigurations = { - traveller = makeHomeConfiguration "cdom" { - modules = [ - profiles.development.work - - { - _module.args = { - inherit ops; - }; - } - ]; - }; - }; - }; } diff --git a/home/features.nix b/home/features.nix index d12013938..b95cc5c9a 100644 --- a/home/features.nix +++ b/home/features.nix @@ -1,68 +1,47 @@ -{ homeProfiles }: let - base = [ - homeProfiles.core.default - homeProfiles.atuin - homeProfiles.development.nix-tools - homeProfiles.direnv - homeProfiles.fzf - homeProfiles.git.default - homeProfiles.helix - homeProfiles.navi - homeProfiles.nnn - homeProfiles.nvim.default - homeProfiles.rclone - homeProfiles.shells.zsh.default - homeProfiles.shells.zsh.with-grml - homeProfiles.ssh - homeProfiles.zellij - homeProfiles.zoxide - ]; - - developer = base ++ [ - homeProfiles.difftools.delta - homeProfiles.emacs.default - homeProfiles.git-sync - homeProfiles.just - homeProfiles.python - homeProfiles.zellij + developer = [ + ./profiles/difftools/delta.nix + ./profiles/emacs/default.nix + ./profiles/git-sync.nix + ./profiles/just.nix + ./profiles/python.nix + ./profiles/zellij.nix ]; graphical = [ - homeProfiles.chromium - homeProfiles.desktop.common - homeProfiles.firefox.default - homeProfiles.keyboard.default - homeProfiles.kitty.default - homeProfiles.foot - homeProfiles.media-client - homeProfiles.spotify - homeProfiles.theme.default - homeProfiles.yt-dlp + ./profiles/chromium.nix + ./profiles/desktop/common.nix + ./profiles/firefox/default.nix + ./profiles/keyboard/default.nix + ./profiles/kitty/default.nix + ./profiles/foot.nix + ./profiles/media-client.nix + ./profiles/spotify.nix + ./profiles/theme/default.nix + ./profiles/yt-dlp.nix # FIXME: nix-managed preferences don't work well with stateful changes (e.g. font size, theme, etc.) # vscode ]; # TODO: move to user-specific dir -- "personalisation" depends on preference anyway personalised = [ - homeProfiles.apple-music - homeProfiles.espanso.default - homeProfiles.newsboat - homeProfiles.obs-studio - homeProfiles.rclone - homeProfiles.spotify - homeProfiles.sync + ./profiles/apple-music.nix + ./profiles/espanso/default.nix + ./profiles/newsboat.nix + ./profiles/obs-studio.nix + ./profiles/rclone.nix + ./profiles/spotify.nix + ./profiles/sync.nix ]; trusted = [ - homeProfiles.gpg.default - homeProfiles.secrets.password-store - homeProfiles.secrets.rbw + ./profiles/gpg/default.nix + ./profiles/secrets/password-store.nix + ./profiles/secrets/rbw.nix ]; features = { inherit - base developer graphical personalised @@ -75,21 +54,21 @@ let ++ personalised ++ trusted ++ [ - homeProfiles.desktop.applications.okular - homeProfiles.desktop.applications.xournal - homeProfiles.development.common - homeProfiles.development.data-wrangling - homeProfiles.emacs.default - homeProfiles.emacs.org-protocol - homeProfiles.git.repo-manager - homeProfiles.git.with-pgp-signing - homeProfiles.kitty.default - homeProfiles.ledger - homeProfiles.pandoc - homeProfiles.sync - homeProfiles.vhs - homeProfiles.writing - homeProfiles.yubikey + ./profiles/desktop/applications/okular.nix + ./profiles/desktop/applications/xournal.nix + ./profiles/development/common.nix + ./profiles/development/data-wrangling.nix + ./profiles/emacs/default.nix + ./profiles/emacs/org-protocol.nix + ./profiles/git/repo-manager.nix + ./profiles/git/with-pgp-signing.nix + ./profiles/kitty/default.nix + ./profiles/ledger.nix + ./profiles/pandoc.nix + ./profiles/sync.nix + ./profiles/vhs.nix + ./profiles/writing.nix + ./profiles/yubikey.nix ]; }; in diff --git a/home/modules-list.nix b/home/modules-list.nix index 22062750b..80dfb1827 100644 --- a/home/modules-list.nix +++ b/home/modules-list.nix @@ -1,4 +1,5 @@ [ + ./modules/dotfield/features.nix ./modules/dotfield/paths.nix ./modules/dotfield/whoami.nix ./modules/theme/default.nix diff --git a/home/modules/dotfield/features.nix b/home/modules/dotfield/features.nix new file mode 100644 index 000000000..e012a279e --- /dev/null +++ b/home/modules/dotfield/features.nix @@ -0,0 +1,13 @@ +moduleArgs@{ config, ... }: +let + inherit (config.home) homeDirectory; + osCfg = moduleArgs.osConfig.dotfield or false; + fsPath = osCfg.paths.fsPath or "${homeDirectory}/.config/dotfield"; +in +{ + options.dotfield.features = { }; + + config = { + home.sessionVariables."DOTFIELD_DIR" = fsPath; + }; +} diff --git a/home/modules/theme/__colorScheme.nix b/home/modules/theme/__colorScheme.nix index 102146cdb..723e649bb 100644 --- a/home/modules/theme/__colorScheme.nix +++ b/home/modules/theme/__colorScheme.nix @@ -5,7 +5,7 @@ { flake }: { config, ... }: let - inherit (flake.self.lib.theme) derivePolarity; + inherit (flake.lib.theme) derivePolarity; inherit (flake.inputs) apparat; inherit (apparat.lib.color) fromHex toHex2; inherit (apparat.types.color) rgbChannelDec rgbChannelHex rgbHex; diff --git a/home/modules/theme/default.nix b/home/modules/theme/default.nix index dcf0303c5..e14179e31 100644 --- a/home/modules/theme/default.nix +++ b/home/modules/theme/default.nix @@ -9,7 +9,7 @@ }: let inherit (flake.inputs) apparat base16-schemes; - inherit (flake.self.lib.theme) mkColorScheme; + inherit (flake.lib.theme) mkColorScheme; inherit (apparat.lib) mkOpt; inherit (base16-schemes.lib) schemes; inherit (l.types) str int; diff --git a/home/profiles/core/home-packages.nix b/home/profiles/core/home-packages.nix index ae3d41938..9f52b3d31 100644 --- a/home/profiles/core/home-packages.nix +++ b/home/profiles/core/home-packages.nix @@ -1,7 +1,7 @@ { pkgs, flake, ... }: { home.packages = [ - flake.perSystem.packages.ddi # <- "nice dd setup for most cases" => + flake.packages.ddi # <- "nice dd setup for most cases" => pkgs.fx # <- interactive terminal json viewer => pkgs.glow # <- charmbracelet's markdown cli renderer diff --git a/home/profiles/development/php.nix b/home/profiles/development/php.nix index 219baac3d..576030e6c 100644 --- a/home/profiles/development/php.nix +++ b/home/profiles/development/php.nix @@ -16,7 +16,7 @@ pkgs.wp-cli # Provides DAP connection to Xdebug for editor support - flake.perSystem.packages.vscode-php-debug + flake.packages.vscode-php-debug ]; home.sessionVariables = { diff --git a/home/profiles/emacs/default.nix b/home/profiles/emacs/default.nix index 1afd4ce1f..7feb0a26f 100644 --- a/home/profiles/emacs/default.nix +++ b/home/profiles/emacs/default.nix @@ -7,7 +7,7 @@ }: let inherit (pkgs.stdenv.hostPlatform) isDarwin; - inherit (flake.perSystem.inputs') emacs-overlay nil-lsp; + inherit (flake.inputs') emacs-overlay nil-lsp; cfg = config.programs.emacs; diff --git a/home/profiles/firefox/profiles.nix b/home/profiles/firefox/profiles.nix index 6210cdc6d..83e4285e1 100644 --- a/home/profiles/firefox/profiles.nix +++ b/home/profiles/firefox/profiles.nix @@ -8,7 +8,7 @@ hmArgs@{ }: let inherit (flake.inputs) apparat haumea; - inherit (flake.perSystem.inputs') firefox-addons; + inherit (flake.inputs') firefox-addons; inherit (apparat.lib.firefox) evalSettings; inherit (pkgs.stdenv) hostPlatform; inherit (pkgs.stdenv.hostPlatform) isLinux; diff --git a/home/profiles/firefox/settings/common.nix b/home/profiles/firefox/settings/common.nix index c22b882d3..a00ac8b1e 100644 --- a/home/profiles/firefox/settings/common.nix +++ b/home/profiles/firefox/settings/common.nix @@ -1,6 +1,5 @@ # TODO: add docs for all "magical" numeric values { - flake, theme, osConfig, lib, @@ -9,8 +8,7 @@ let # FIXME: only do theme stuff if theme enabled for user inherit (theme) fonts; - l = flake.inputs.nixpkgs.lib // builtins; - hostName = osConfig.networking.hostName or (l.getEnv "HOSTNAME"); + hostName = osConfig.networking.hostName or (builtins.getEnv "HOSTNAME"); in { "browser.bookmarks.showMobileBookmarks" = true; diff --git a/home/profiles/fzf.nix b/home/profiles/fzf.nix index d97e71e0f..184bc4fd0 100644 --- a/home/profiles/fzf.nix +++ b/home/profiles/fzf.nix @@ -17,7 +17,7 @@ let dirPreviewCommand = l.getExe pkgs.eza + " --tree {} | head -n 200"; in { - home.packages = [ flake.perSystem.packages.igr ]; + home.packages = [ flake.packages.igr ]; programs.fzf = { enable = true; diff --git a/home/profiles/git/default.nix b/home/profiles/git/default.nix index 78c5394e1..4918f3f08 100644 --- a/home/profiles/git/default.nix +++ b/home/profiles/git/default.nix @@ -6,7 +6,7 @@ ... }: let - inherit (flake.perSystem) packages; + inherit (flake) packages; inherit (config.dotfield.whoami) email fullName githubUserName; in { diff --git a/home/profiles/git/repo-manager.nix b/home/profiles/git/repo-manager.nix index ea4673a31..c2c440f62 100644 --- a/home/profiles/git/repo-manager.nix +++ b/home/profiles/git/repo-manager.nix @@ -1,4 +1,4 @@ { lib, flake, ... }: { - home.packages = lib.singleton flake.perSystem.packages.git-repo-manager; + home.packages = lib.singleton flake.packages.git-repo-manager; } diff --git a/home/profiles/media-client.nix b/home/profiles/media-client.nix index a395987ed..854262823 100644 --- a/home/profiles/media-client.nix +++ b/home/profiles/media-client.nix @@ -15,7 +15,6 @@ in imports = [ ./mpv.nix ./jellyfin-client.nix - ./plex-client.nix ]; xdg.mimeApps.defaultApplications = diff --git a/home/profiles/mpv.nix b/home/profiles/mpv.nix index b850ceef5..3a0651b2d 100644 --- a/home/profiles/mpv.nix +++ b/home/profiles/mpv.nix @@ -1,35 +1,23 @@ -moduleArgs@{ - config, - lib, - pkgs, - ... -}: +moduleArgs@{ lib, pkgs, ... }: let - inherit (config.dotfield.features) hasWayland; - isGnomeDesktop = moduleArgs.osConfig.services.xserver.desktopManager.gnome.enable or false; hasNvidia = moduleArgs.osConfig.dotfield.features.hasNvidia or false; in { programs.mpv = { enable = true; - scripts = - with pkgs.mpvScripts; - [ - autoload # autoload playlist entries before/after current file - thumbnail # show thumbnail in seekbar - mpv-playlistmanager - ] - # TODO: source? - # prevent screen blanking in GNOME - ++ lib.optional isGnomeDesktop inhibit-gnome; + scripts = with pkgs.mpvScripts; [ + autoload # autoload playlist entries before/after current file + thumbnail # show thumbnail in seekbar + mpv-playlistmanager + ]; config = lib.mkMerge [ { + gpu-context = "wayland"; # FIXME: doesn't belong here...? ytdl-format = "bestvideo+bestaudio"; cache-default = 4000000; } (lib.optionalAttrs hasNvidia { hwdec = "vdpau"; }) - (lib.optionalAttrs hasWayland { gpu-context = "wayland"; }) ]; }; } diff --git a/home/profiles/plex-client.nix b/home/profiles/plex-client.nix deleted file mode 100644 index 0a25f406b..000000000 --- a/home/profiles/plex-client.nix +++ /dev/null @@ -1,13 +0,0 @@ -moduleArgs@{ config, lib, ... }: -let - inherit (config.dotfield.features) hasWayland; - hasNvidia = moduleArgs.osConfig.dotfield.features.hasNvidia or false; -in -{ - # https://aur.archlinux.org/packages/plex-htpc#comment-854436 - xdg.dataFile."plex/mpv.conf".text = '' - cache-default=4000000 - ${lib.optionalString hasNvidia "hwdec=vdpau"} - ${lib.optionalString hasWayland "gpu-context=wayland"} - ''; -} diff --git a/home/profiles/shells/bash/default.nix b/home/profiles/shells/bash/default.nix index c8d2eea0f..05101a10c 100644 --- a/home/profiles/shells/bash/default.nix +++ b/home/profiles/shells/bash/default.nix @@ -8,7 +8,7 @@ ... }: let - inherit (flake.perSystem.packages) fzf-tab-completion; + inherit (flake.packages) fzf-tab-completion; in { home.extraOutputsToInstall = [ "/share/bash-completion" ]; diff --git a/home/profiles/shells/fish/with-fifc-completion.nix b/home/profiles/shells/fish/with-fifc-completion.nix index 199363c71..30b157575 100644 --- a/home/profiles/shells/fish/with-fifc-completion.nix +++ b/home/profiles/shells/fish/with-fifc-completion.nix @@ -1,7 +1,7 @@ { config, flake, ... }: { # Unreleased: https://github.com/gazorby/fifc/issues/31 - programs.fish.plugins = [ ({ inherit (flake.perSystem.packages.fish-plugin-fifc) name src; }) ]; + programs.fish.plugins = [ ({ inherit (flake.packages.fish-plugin-fifc) name src; }) ]; programs.fish.interactiveShellInit = '' # Required, apparently... set -x fifc_editor ${config.home.sessionVariables."EDITOR"} diff --git a/home/profiles/theme/__kitty.nix b/home/profiles/theme/__kitty.nix index 83f804be9..b83cab2b2 100644 --- a/home/profiles/theme/__kitty.nix +++ b/home/profiles/theme/__kitty.nix @@ -6,7 +6,7 @@ }: let inherit (flake.inputs.apparat.lib.kitty) makeConf makeThemeAttrs; - inherit (flake.self.lib.theme) asHexStrings; + inherit (flake.lib.theme) asHexStrings; inherit (config) theme; cfg = config.programs.kitty; in diff --git a/home/profiles/theme/default.nix b/home/profiles/theme/default.nix index 6ba26aab6..34ba08c54 100644 --- a/home/profiles/theme/default.nix +++ b/home/profiles/theme/default.nix @@ -6,7 +6,7 @@ }: let inherit (flake.inputs.base16-schemes.lib) schemes; - inherit (flake.self.lib.theme) mkColorScheme; + inherit (flake.lib.theme) mkColorScheme; in { imports = [ diff --git a/home/profiles/theme/font-presets/monospace/berkeley-mono.nix b/home/profiles/theme/font-presets/monospace/berkeley-mono.nix index b5d4f2daf..702f0a141 100644 --- a/home/profiles/theme/font-presets/monospace/berkeley-mono.nix +++ b/home/profiles/theme/font-presets/monospace/berkeley-mono.nix @@ -1,6 +1,6 @@ { config, flake, ... }: let - inherit (flake.perSystem.packages) berkeley-mono; + inherit (flake.packages) berkeley-mono; cfg = config.theme.fonts; in { diff --git a/home/profiles/writing.nix b/home/profiles/writing.nix index 2ca7b5622..fd275f4db 100644 --- a/home/profiles/writing.nix +++ b/home/profiles/writing.nix @@ -1,7 +1,7 @@ { flake, pkgs, ... }: { home.packages = [ - flake.perSystem.packages.aspell-with-dicts + flake.packages.aspell-with-dicts pkgs.enchant pkgs.languagetool @@ -9,5 +9,5 @@ # Not the greatest workaround, but... # - home.sessionVariables.ASPELL_CONF = "dict-dir ${flake.perSystem.packages.aspell-with-dicts}/lib/aspell"; + home.sessionVariables.ASPELL_CONF = "dict-dir ${flake.packages.aspell-with-dicts}/lib/aspell"; } diff --git a/lib/default.nix b/lib/default.nix index 6fc65a768..d8ada6087 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,26 +1,46 @@ { - inputs, + lib, self, - config, withSystem, ops, ... }: let - haumea = inputs.haumea.lib; + inherit (self.inputs) apparat haumea; - lib = haumea.load { + lib' = haumea.lib.load { src = ./src; inputs = { - inherit ops withSystem; - flake = { - inherit self inputs config; - }; + inherit apparat lib ops; }; }; in { - flake.lib = lib // { - inherit ops; + flake.lib = lib' // { + # FIXME: remove + # inherit ops; + + specialArgsFor = + system: + withSystem system ( + { + inputs', + config, + pkgs, + ... + }: + { + # FIXME: remove + inherit ops; + + flake = { + inherit (self) inputs; + inherit inputs' ops; + lib = lib'; + inherit (config) packages; + path = self.outPath; + }; + } + ); }; } diff --git a/lib/src/colmena.nix b/lib/src/colmena.nix index cc6e6b24b..f958461ff 100644 --- a/lib/src/colmena.nix +++ b/lib/src/colmena.nix @@ -1,6 +1,6 @@ -{ flake, withSystem, ... }: +{ lib, withSystem, ... }: let - l = flake.inputs.nixpkgs.lib // builtins; + inherit (builtins) mapAttrs; in { mkNode = @@ -12,7 +12,7 @@ in }; defaults = { deployment = { - buildOnTarget = l.mkDefault true; + buildOnTarget = lib.mkDefault true; }; }; in @@ -30,8 +30,8 @@ in # In the end, this setting gets overridden on a per-host basis. nixpkgs = withSystem "x86_64-linux" (ctx: ctx.pkgs); description = "my personal machines"; - nodeNixpkgs = l.mapAttrs (_: v: v.pkgs) evaled; - nodeSpecialArgs = l.mapAttrs (_: v: v._module.specialArgs) evaled; + nodeNixpkgs = mapAttrs (_: v: v.pkgs) evaled; + nodeSpecialArgs = mapAttrs (_: v: v._module.specialArgs) evaled; }; }; } diff --git a/lib/src/hm.nix b/lib/src/hm.nix deleted file mode 100644 index b45437854..000000000 --- a/lib/src/hm.nix +++ /dev/null @@ -1,68 +0,0 @@ -{ - ops, - super, - flake, - withSystem, - ... -}: -let - inherit (super.modules) flakeSpecialArgs flakeSpecialArgs'; - inherit (flake.inputs) apparat haumea home-manager; - inherit (apparat.lib) homePrefix; - - homeModules = import "${flake.self}/home/modules-list.nix"; - profiles = import "${flake.self}/home/profiles.nix" { inherit haumea; }; - features = import "${flake.self}/home/features.nix" { homeProfiles = profiles; }; - - specialArgs = { - inherit features profiles; - flake = flakeSpecialArgs; - }; - specialArgs' = system: specialArgs // { flake = flakeSpecialArgs' system; }; - - settings = { - extraSpecialArgs = specialArgs; - sharedModules = defaultModules; - useGlobalPkgs = true; - useUserPackages = true; - }; - settings' = system: settings // { extraSpecialArgs = specialArgs' system; }; - - defaultModules = - homeModules - ++ features.base - ++ [ - { - _module.args = { - inherit ops; - }; - } - ]; -in -{ - inherit defaultModules settings settings'; - - makeHomeConfiguration = - username: args: - let - inherit (args) pkgs; - # FIXME: should be hostPlatform? - inherit (pkgs.stdenv) system; - in - withSystem system ( - { pkgs, ... }: - (home-manager.lib.homeManagerConfiguration { - inherit pkgs; - extraSpecialArgs = specialArgs' system; - modules = - defaultModules - ++ (args.modules or [ ]) - ++ [ - { - home.username = username; - home.homeDirectory = "${homePrefix system}/${username}"; - } - ]; - }) - ); -} diff --git a/lib/src/modules.nix b/lib/src/modules.nix deleted file mode 100644 index 0423bae16..000000000 --- a/lib/src/modules.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ flake, withSystem, ... }: -let - flakeSpecialArgs = flake; - flakeSpecialArgs' = - system: - withSystem system ( - { inputs', ... }@ctx: - let - perSystem = { - inherit (ctx.config) packages; - inherit inputs'; - }; - in - flakeSpecialArgs // { inherit perSystem; } - ); -in -{ - inherit flakeSpecialArgs flakeSpecialArgs'; -} diff --git a/lib/src/theme.nix b/lib/src/theme.nix index f73617910..d785ecf75 100644 --- a/lib/src/theme.nix +++ b/lib/src/theme.nix @@ -1,15 +1,15 @@ # SPDX-FileCopyrightText: Copyright (c) 2023 Chris Montgomery # SPDX-FileCopyrightText: Copyright (c) 2019 Robert Helgesson # SPDX-License-Identifier: GPL-3.0-or-later OR MIT -{ flake, ... }: +{ apparat, lib, ... }: let - inherit (flake.inputs) apparat; inherit (apparat.lib.color) fromHex; - l = flake.inputs.nixpkgs.lib // builtins; + + inherit (builtins) mapAttrs replaceStrings substring; # TODO: prob more useful to expand scope as a general colorscheme getter since # even with this fn it's pretty repetitive - asHexStrings = l.mapAttrs (_: v: v.hex.r + v.hex.g + v.hex.b); + asHexStrings = mapAttrs (_: v: v.hex.r + v.hex.g + v.hex.b); /* Guesstimate light/dark polarity for a decimal color value. @@ -53,9 +53,9 @@ let v: let hex = { - r = l.substring 0 2 v; - g = l.substring 2 2 v; - b = l.substring 4 2 v; + r = substring 0 2 v; + g = substring 2 2 v; + b = substring 4 2 v; }; dec = { r = fromHex hex.r; @@ -83,12 +83,12 @@ let mkColorScheme = scheme: let - bases = l.filterAttrs (n: _: l.hasPrefix "base" n) scheme; - colors = l.mapAttrs (_: mkColor) bases; + bases = lib.filterAttrs (n: _: lib.hasPrefix "base" n) scheme; + colors = mapAttrs (_: mkColor) bases; in { inherit colors; - name = l.replaceStrings [ " " ] [ "-" ] scheme.scheme; + name = replaceStrings [ " " ] [ "-" ] scheme.scheme; kind = derivePolarity { inherit (colors.base00) dec; }; }; in diff --git a/machines/hierophant/matrix/synapse.nix b/machines/hierophant/matrix/synapse.nix index 802f2954a..0636645e9 100644 --- a/machines/hierophant/matrix/synapse.nix +++ b/machines/hierophant/matrix/synapse.nix @@ -7,7 +7,7 @@ }: let inherit (ops.networks.loopgarden) domain; - inherit (flake.perSystem) packages; + inherit (flake) packages; l = flake.inputs.nixpkgs.lib // builtins; cfg = config.services.matrix-synapse; fqdn = "matrix.${domain}"; diff --git a/machines/tuvok/default.nix b/machines/tuvok/default.nix index 07e94df9a..08acf0658 100644 --- a/machines/tuvok/default.nix +++ b/machines/tuvok/default.nix @@ -18,6 +18,7 @@ # support DP-Alt display output. DP-Alt output is required for true HDMI or # DP output via one of this machine's two USB-C ports and zero HDMI/DP ports. services.xserver.videoDrivers = [ "displaylink" ]; + dotfield.nixpkgs.allowedUnfreePackages = [ "displaylink" ]; system.stateVersion = "23.11"; # Did you read the comment? } diff --git a/machines/tuvok/users/cdom.nix b/machines/tuvok/users/cdom.nix index 504d53df2..3f7247c1b 100644 --- a/machines/tuvok/users/cdom.nix +++ b/machines/tuvok/users/cdom.nix @@ -17,26 +17,5 @@ in shell = pkgs.zsh; }; - home-manager.users.${username} = - { profiles, features, ... }: - { - imports = features.workstation ++ [ - profiles.desktop.applications.microsoft-teams - profiles.development.work.default - profiles.editors.jetbrains - profiles.gpg.with-ssh-support - profiles.shells.prompts.starship.default - - { - # The trackpad on this device is huge, and I always end up touching - # its corner with my palm, which is very disruptive. Actually, it is - # not only disruptive, but also has led to pain due to habitual thumb - # hyper-extension in avoidance of the trackpad. - # - # FIXME: still needs some way to disable touch input until explicitly needed... - dconf.settings."org/gnome/desktop/peripherals/touchpad".tap-to-click = false; - } - ]; - home.stateVersion = "23.05"; - }; + home-manager.users.cdom = import ../../../users/cdom/at-tuvok.nix; } diff --git a/nixos/baseline.nix b/nixos/baseline.nix new file mode 100644 index 000000000..63ab3d7c3 --- /dev/null +++ b/nixos/baseline.nix @@ -0,0 +1,5 @@ +[ + ./profiles/core/default.nix + ./profiles/boot/common.nix + ./profiles/networking/tailscale.nix +] diff --git a/nixos/default.nix b/nixos/default.nix index 369478a81..a06178ef9 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -1,66 +1,65 @@ { self, - withSystem, - ops, + inputs, + lib, + flake-parts-lib, ... }: let - inherit (self) inputs; - inherit (self.inputs) - haumea + inherit (inputs) home-manager nixos-apple-silicon - nixpkgs sops-nix srvos ; + inherit (flake-parts-lib) importApply; - lib' = self.lib; + features = import ./features.nix; - modules = import ./modules-list.nix; - profiles = import ./profiles.nix { inherit haumea; }; - features = import ./features.nix { inherit profiles; }; - - defaultModules = [ - home-manager.nixosModules.home-manager - sops-nix.nixosModules.sops + initSystemModule = + { hostName }: + { + imports = [ ../machines/${hostName} ]; + networking.hostName = hostName; + }; - profiles.core.default - profiles.boot.common - profiles.networking.tailscale - ]; + initNixpkgsModule = importApply ../packages/nixpkgs-config.nix; makeNixosSystem = - hostName: - nixosArgs@{ + hostName: system: + { channel ? "unstable", - system, - ... + modules ? [ ], + overlays ? [ ], + allowUnfree ? false, }: - withSystem system ( - { pkgs, ... }: - inputs."nixos-${channel}".lib.nixosSystem { - inherit system; - specialArgs = { - inherit profiles; - flake = lib'.modules.flakeSpecialArgs' system; - }; - modules = - defaultModules - ++ modules - ++ (nixosArgs.modules or [ ]) - ++ [ - ../machines/${hostName} - { - _module.args = { - inherit ops; - }; - nixpkgs.pkgs = nixosArgs.pkgs or pkgs; - networking.hostName = hostName; - } - ]; - } - ); + let + channelInput = "nixos-${channel}"; + specialArgs = self.lib.specialArgsFor system; + in + inputs.${channelInput}.lib.nixosSystem { + inherit system specialArgs; + modules = + modules + ++ (import ./modules-list.nix) + ++ (import ./baseline.nix) + ++ [ + home-manager.nixosModules.home-manager + sops-nix.nixosModules.sops + + (initSystemModule { inherit hostName; }) + (initNixpkgsModule { inherit allowUnfree overlays; }) + + { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + sharedModules = (import ../home/modules-list.nix) ++ (import ../home/baseline.nix); + extraSpecialArgs = specialArgs; + }; + } + ]; + }; in { flake.nixosModules = { @@ -73,39 +72,27 @@ in # modules = with features; desktop ++ gnome ++ workstation; # }; - ryosuke = makeNixosSystem "ryosuke" { - system = "x86_64-linux"; + ryosuke = makeNixosSystem "ryosuke" "x86_64-linux" { modules = - (with features; desktop ++ gnome ++ webdev ++ workstation) - ++ (with profiles; [ - hardware.amd - hardware.razer - # login.greetd - # virtualisation.vm-variant - ]); + features.desktop + ++ features.gnome + ++ features.workstation + ++ [ + ./profiles/hardware/amd.nix + ./profiles/hardware/razer.nix + ]; }; - tuvok = makeNixosSystem "tuvok" ( - let - system = "aarch64-linux"; - in - { - inherit system; - pkgs = import nixpkgs { - inherit system; - config.allowUnfree = true; - overlays = [ nixos-apple-silicon.overlays.default ]; - }; - modules = - features.gnome - ++ features.desktop - ++ features.workstation - ++ [ profiles.hardware.apple.macbook-14-2 ]; - } - ); - - moraine = makeNixosSystem "moraine" { - system = "x86_64-linux"; + tuvok = makeNixosSystem "tuvok" "aarch64-linux" ({ + overlays = [ nixos-apple-silicon.overlays.default ]; + modules = + features.gnome + ++ features.desktop + ++ features.workstation + ++ [ ./profiles/hardware/apple/macbook-14-2.nix ]; + }); + + moraine = makeNixosSystem "moraine" "x86_64-linux" { modules = features.server ++ [ srvos.nixosModules.server srvos.nixosModules.hardware-hetzner-online-amd @@ -122,38 +109,37 @@ in ]; }; - boschic = makeNixosSystem "boschic" { - system = "x86_64-linux"; + boschic = makeNixosSystem "boschic" "x86_64-linux" { modules = - (with features; gnome ++ desktop ++ webdev ++ workstation) - ++ (with profiles; [ - boot.refind - desktop.flatpak + features.desktop + ++ features.gnome + ++ features.workstation + ++ [ + ./profiles/boot/refind.nix + ./profiles/desktop/flatpak.nix # FIXME: clarify that this means an amd cpu, NOT gpu - hardware.amd - hardware.focusrite-scarlett-18i20-mk1 + ./profiles/hardware/amd.nix + ./profiles/hardware/focusrite-scarlett-18i20-mk1.nix # TODO: rename to note that this is gpu, making it mutually exclusive with an AMD GPU # (same goes for intel/amd cpu but i don't bother with intel cpus) - hardware.nvidia.stable-release - hardware.razer - ]); + ./profiles/hardware/nvidia/stable-release.nix + ./profiles/hardware/razer.nix + ]; }; - hodgepodge = makeNixosSystem "hodgepodge" { - system = "x86_64-linux"; + hodgepodge = makeNixosSystem "hodgepodge" "x86_64-linux" { modules = features.gnome ++ features.desktop ++ features.workstation ++ [ - profiles.hardware.apple.macbookpro-11-3 - profiles.virtualisation.quickemu + ./profiles/hardware/apple/macbookpro-11-3.nix + ./profiles/virtualisation/quickemu.nix ]; }; - chert = makeNixosSystem "chert" { + chert = makeNixosSystem "chert" "x86_64-linux" { channel = "stable"; - system = "x86_64-linux"; modules = features.server ++ [ # TODO: verify whether these conflict with operations, esp. non-mutable users? # srvos.nixosModules.server @@ -167,8 +153,7 @@ in ]; }; - gabbro = makeNixosSystem "gabbro" { - system = "x86_64-linux"; + gabbro = makeNixosSystem "gabbro" "x86_64-linux" { modules = features.server ++ [ # TODO: verify whether these conflict with operations, esp. non-mutable users? # srvos.nixosModules.server @@ -182,8 +167,7 @@ in ]; }; - hierophant = makeNixosSystem "hierophant" { - system = "x86_64-linux"; + hierophant = makeNixosSystem "hierophant" "x86_64-linux" { modules = features.server ++ [ srvos.nixosModules.server srvos.nixosModules.hardware-hetzner-cloud diff --git a/nixos/features.nix b/nixos/features.nix index d91c3439d..de9115c7a 100644 --- a/nixos/features.nix +++ b/nixos/features.nix @@ -1,18 +1,17 @@ -{ profiles }: let audio = [ - profiles.audio - profiles.bluetooth - profiles.hardware.bluetooth-headset + ./profiles/audio.nix + ./profiles/bluetooth.nix + ./profiles/hardware/bluetooth-headset.nix ]; graphical = [ - profiles.desktop.common + ./profiles/desktop/common.nix # FIXME: find a more appropriate "feature" to file systemd-boot under # it is not universal -- there's also rEFInd but i haven't used that # in a while. consider singularity. - profiles.boot.systemd-boot + ./profiles/boot/systemd-boot.nix ]; # FIXME: why? @@ -22,19 +21,19 @@ let ++ audio ++ tangible ++ [ - profiles.power - profiles.desktop.gnome-services - profiles.networking.avahi + ./profiles/power.nix + ./profiles/desktop/gnome-services.nix + ./profiles/networking/avahi.nix ]; # wlroots-based Wayland compositors wlroots = desktop ++ [ - profiles.desktop.kde-services - profiles.networking.networkmanager + ./profiles/desktop/kde-services.nix + ./profiles/networking/networkmanager.nix ]; # Machines I can physically touch. - tangible = [ profiles.hardware.keyboard.default ]; + tangible = [ ./profiles/hardware/keyboard/default.nix ]; in { inherit @@ -46,31 +45,31 @@ in ; gnome = desktop ++ [ - profiles.desktop.gnome-desktop - profiles.desktop.nixpkgs-wayland - profiles.login.gdm + ./profiles/desktop/gnome-desktop.nix + ./profiles/desktop/nixpkgs-wayland.nix + ./profiles/login/gdm.nix ]; - server = [ profiles.server.acme ]; + server = [ ./profiles/server/acme.nix ]; # FIXME: pare these down, also they don't really have anything to do with 'webdev' webdev = [ - profiles.virtualisation.libvirt - profiles.virtualisation.podman - profiles.virtualisation.virt-manager + ./profiles/virtualisation/libvirt.nix + ./profiles/virtualisation/podman.nix + ./profiles/virtualisation/virt-manager.nix ]; workstation = desktop ++ [ - profiles.boot.systemd-boot - profiles.location + ./profiles/boot/systemd-boot.nix + ./profiles/location.nix - profiles.one-password - profiles.bitwarden + ./profiles/one-password.nix + ./profiles/bitwarden.nix - profiles.hardware.android-devices.common - profiles.hardware.android-devices.supernote-a5x - profiles.hardware.printers-scanners.common - profiles.hardware.printers-scanners.epson-wf-3520 - profiles.hardware.yubikey + ./profiles/hardware/android-devices/common.nix + ./profiles/hardware/android-devices/supernote-a5x.nix + ./profiles/hardware/printers-scanners/common.nix + ./profiles/hardware/printers-scanners/epson-wf-3520.nix + ./profiles/hardware/yubikey.nix ]; } diff --git a/nixos/modules/dotfield/default.nix b/nixos/modules/dotfield/default.nix index e1197e2b2..35d8f0e08 100644 --- a/nixos/modules/dotfield/default.nix +++ b/nixos/modules/dotfield/default.nix @@ -6,22 +6,22 @@ }: let inherit (pkgs.stdenv.hostPlatform) isDarwin; - l = lib // builtins; + inherit (lib) mkOption types; - osCfg = config.dotfield; - - featuresOpt = l.mkOption { - type = l.types.attrsOf l.types.unspecified; - default = { }; - }; - - # Whether Impermanence aka "ephemeral root storage" aka "darling erasure" - # is enabled for this configuration. - # - # TODO: until impermanence support is added, this should be set to false. - # for the time being, we use the setting to prepare for impermanence prior - # to implementation. - hasImpermanence = false; + featuresSubmodule = types.submodule ( + { options, ... }: + { + options = { + hasNvidia = mkOption { + type = types.bool; + readOnly = true; + description = '' + Whether a NixOS system has enabled the proprietary NVIDIA drivers. + ''; + }; + }; + } + ); in { imports = [ @@ -30,69 +30,29 @@ in ./_users.nix ]; options.dotfield = { - enable = l.mkOption { + enable = mkOption { default = true; - type = l.types.bool; + type = types.bool; + }; + features = mkOption { + type = featuresSubmodule; + default = { }; }; - features = featuresOpt; paths = { - fsPath = l.mkOption { - type = l.types.str; + fsPath = mkOption { + type = types.str; default = if isDarwin then "$HOME/.config/dotfield" else "/etc/dotfield"; }; - persistence = l.mkOption { - type = l.types.str; - default = "/persist"; - description = '' - Absolute path to non-ephemeral file storage. - ''; - }; - # FIXME: replace with explicit usage of `dotfield.paths.persistence` - storageBase = l.mkOption { - type = l.types.str; - default = if hasImpermanence then "/persist" else ""; - description = '' - Absolute path to the root directory for non-ephemeral file storage, - taking impermanence settings into account. - ''; - }; }; }; config = { dotfield = { - # FIXME: make submodule features = { - inherit hasImpermanence; - - # Whether a NixOS system has enabled the proprietary NVIDIA drivers. # FIXME: The default `false` value indicates that we cannot know with # certainty whether NVIDIA drives are in use. This may be the case, for # example, on generic Linux with a standalone home-manager. hasNvidia = config.hardware.nvidia.modesetting.enable or false; - - # Whether the system has any features indicating a Wayland session. - hasWayland = - config.services.xserver.displayManager.gdm.wayland or config.programs.sway.enable or false; }; }; - - home-manager.sharedModules = [ - { home.sessionVariables."DOTFIELD_DIR" = osCfg.paths.fsPath; } - ( - hmArgs: - let - hmConfig = hmArgs.config; - hasSway = hmConfig.wayland.windowManager.sway.enable; - in - { - options.dotfield.features = featuresOpt; - # FIXME: make submodule - config.dotfield.features = { - inherit hasSway; - hasWayland = osCfg.hasWayland or hasSway; - }; - } - ) - ]; }; } diff --git a/nixos/profiles/core/__home-manager.nix b/nixos/profiles/core/__home-manager.nix deleted file mode 100644 index d3898b7eb..000000000 --- a/nixos/profiles/core/__home-manager.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ flake, pkgs, ... }: -let - inherit (pkgs.stdenv.hostPlatform) system; - inherit (flake.self.lib.hm) settings'; -in -{ - home-manager = settings' system; -} diff --git a/nixos/profiles/core/__secrets.nix b/nixos/profiles/core/__secrets.nix index 18d436784..2ee47951f 100644 --- a/nixos/profiles/core/__secrets.nix +++ b/nixos/profiles/core/__secrets.nix @@ -1,16 +1,7 @@ -{ - config, - lib, - pkgs, - ... -}: -let - inherit (config.dotfield.paths) storageBase; - sshPath = "${storageBase}/etc/ssh"; -in +{ lib, pkgs, ... }: { # TODO: what about rsa keys? - sops.age.sshKeyPaths = [ "${sshPath}/ssh_host_ed25519_key" ]; + sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ]; home-manager.sharedModules = lib.singleton { # Allow normal users to use sops. diff --git a/nixos/profiles/core/default.nix b/nixos/profiles/core/default.nix index 78621cd10..d4728e23f 100644 --- a/nixos/profiles/core/default.nix +++ b/nixos/profiles/core/default.nix @@ -1,24 +1,17 @@ { - config, lib, ops, - pkgs, flake, ... }: let inherit (flake.inputs.apparat.constants.networking) dns; - # FIXME: idk, i don't like the idea that this well-known directory - # would be located at `/persist/etc/ssh/` instead of `/etc/ssh/`... - inherit (config.dotfield.paths) storageBase; - sshHostPath = "${storageBase}/etc/ssh"; in { imports = [ ./nix-config ./__environment.nix - ./__home-manager.nix ./__nh.nix ./__nix-index.nix ./__secrets.nix @@ -68,11 +61,11 @@ in hostKeys = [ { bits = 4096; - path = "${sshHostPath}/ssh_host_rsa_key"; + path = "/etc/ssh/ssh_host_rsa_key"; type = "rsa"; } { - path = "${sshHostPath}/ssh_host_ed25519_key"; + path = "/etc/ssh/ssh_host_ed25519_key"; type = "ed25519"; } ]; diff --git a/nixos/profiles/desktop/__gtk.nix b/nixos/profiles/desktop/__gtk.nix index f4e7bc65b..78d4177b3 100644 --- a/nixos/profiles/desktop/__gtk.nix +++ b/nixos/profiles/desktop/__gtk.nix @@ -13,5 +13,5 @@ in environment.systemPackages = [ pkgs.gnome.dconf-editor ]; xdg.portal.extraPortals = lib.optional (!isGnomeDesktop) pkgs.xdg-desktop-portal-gtk; - home-manager.sharedModules = [ "${flake.self}/home/profiles/desktop/gtk.nix" ]; + home-manager.sharedModules = [ "${flake.path}/home/profiles/desktop/gtk.nix" ]; } diff --git a/nixos/profiles/desktop/__qt.nix b/nixos/profiles/desktop/__qt.nix index 4df0393e8..543febf73 100644 --- a/nixos/profiles/desktop/__qt.nix +++ b/nixos/profiles/desktop/__qt.nix @@ -2,5 +2,5 @@ { qt.enable = true; - home-manager.sharedModules = [ "${flake.self}/home/profiles/desktop/qt.nix" ]; + home-manager.sharedModules = [ "${flake.path}/home/profiles/desktop/qt.nix" ]; } diff --git a/nixos/profiles/desktop/fonts/berkeley-mono.nix b/nixos/profiles/desktop/fonts/berkeley-mono.nix index 25da4a3a5..cb8505d86 100644 --- a/nixos/profiles/desktop/fonts/berkeley-mono.nix +++ b/nixos/profiles/desktop/fonts/berkeley-mono.nix @@ -1,6 +1,6 @@ { flake, ... }: let - inherit (flake.perSystem.packages) berkeley-mono; + inherit (flake.packages) berkeley-mono; in { fonts.packages = [ berkeley-mono ]; diff --git a/nixos/profiles/desktop/fonts/default.nix b/nixos/profiles/desktop/fonts/default.nix index 465a7e3f0..8f6eaebcc 100644 --- a/nixos/profiles/desktop/fonts/default.nix +++ b/nixos/profiles/desktop/fonts/default.nix @@ -19,7 +19,6 @@ # # charis-sil - corefonts dejavu_fonts fira gentium diff --git a/nixos/profiles/desktop/gnome-desktop.nix b/nixos/profiles/desktop/gnome-desktop.nix index 62799af1b..ab110e041 100644 --- a/nixos/profiles/desktop/gnome-desktop.nix +++ b/nixos/profiles/desktop/gnome-desktop.nix @@ -6,7 +6,7 @@ ... }: let - homeProfiles = import "${flake.self}/home/profiles.nix" { inherit (flake.inputs) haumea; }; + homeProfiles = import "${flake.path}/home/profiles.nix" { inherit (flake.inputs) haumea; }; isAutoLoginEnabled = config.services.displayManager.autoLogin.enable; in { diff --git a/nixos/profiles/hardware/apple/apple-silicon.nix b/nixos/profiles/hardware/apple/apple-silicon.nix index 69853d984..1017647fc 100644 --- a/nixos/profiles/hardware/apple/apple-silicon.nix +++ b/nixos/profiles/hardware/apple/apple-silicon.nix @@ -1,7 +1,6 @@ { config, lib, - profiles, flake, ... }: @@ -9,11 +8,12 @@ let inherit (config.networking) hostName; inherit (flake.inputs) nixos-apple-silicon; firmwareInputName = "asahi-${hostName}-firmware"; - firmwareInput = flake.perSystem.inputs'.${firmwareInputName}; + firmwareInput = flake.inputs'.${firmwareInputName}; in { imports = [ - profiles.boot.systemd-boot + ../../boot/systemd-boot.nix + nixos-apple-silicon.nixosModules.apple-silicon-support ]; diff --git a/nixos/profiles/hardware/keyboard/default.nix b/nixos/profiles/hardware/keyboard/default.nix index 0795ff94b..4acd89405 100644 --- a/nixos/profiles/hardware/keyboard/default.nix +++ b/nixos/profiles/hardware/keyboard/default.nix @@ -9,6 +9,7 @@ hardware.keyboard.keyboardio.enable = true; + dotfield.nixpkgs.allowedUnfreePackages = [ "keymapp" ]; hardware.keyboard.zsa.enable = true; environment.systemPackages = [ pkgs.keymapp diff --git a/nixos/profiles/hardware/laptop.nix b/nixos/profiles/hardware/laptop.nix index 693cd0f43..46d7d37ef 100644 --- a/nixos/profiles/hardware/laptop.nix +++ b/nixos/profiles/hardware/laptop.nix @@ -1,6 +1,6 @@ { flake, lib, ... }: let - homeProfiles = import "${flake.self}/home/profiles.nix" { inherit (flake.inputs) haumea; }; + homeProfiles = import "${flake.path}/home/profiles.nix" { inherit (flake.inputs) haumea; }; in { # battery info diff --git a/nixos/profiles/hardware/printers-scanners/epson-wf-3520.nix b/nixos/profiles/hardware/printers-scanners/epson-wf-3520.nix index 4d0c7f619..9149675a3 100644 --- a/nixos/profiles/hardware/printers-scanners/epson-wf-3520.nix +++ b/nixos/profiles/hardware/printers-scanners/epson-wf-3520.nix @@ -55,13 +55,15 @@ # - utsushi (usb/scsi only) # # I have not tested USB scanning but I'm sure it's much more straightforward. -{ pkgs, ... }: +{ lib, pkgs, ... }: let ip = "192.168.1.192"; in { imports = [ ./common.nix ]; + nixpkgs.config.allowlistedLicenses = [ lib.licenses.epson ]; + hardware.sane.extraBackends = [ pkgs.epkowa diff --git a/nixos/profiles/one-password.nix b/nixos/profiles/one-password.nix index edc93a43c..0111abee4 100644 --- a/nixos/profiles/one-password.nix +++ b/nixos/profiles/one-password.nix @@ -3,6 +3,11 @@ let isGraphical = config.services.xserver.enable; in { + dotfield.nixpkgs.allowedUnfreePackages = [ + "1password-cli" + "1password" + ]; + home-manager.sharedModules = lib.singleton ( { pkgs, ... }: { diff --git a/packages/nixpkgs-config.nix b/packages/nixpkgs-config.nix new file mode 100644 index 000000000..5f77cf18a --- /dev/null +++ b/packages/nixpkgs-config.nix @@ -0,0 +1,29 @@ +{ overlays, allowUnfree }: +{ lib, config, ... }: +let + inherit (builtins) elem isBool isList; + inherit (lib) getName mkOption types; +in +{ + options.dotfield.nixpkgs = { + allowedUnfreePackages = mkOption { + default = [ ]; + type = with types; listOf str; + description = '' + Default allowed unfree packages. + ''; + }; + }; + + config = { + nixpkgs = { + inherit overlays; + config.allowUnfree = if (isBool allowUnfree) then allowUnfree else false; + config.allowUnfreePredicate = + if (isList allowUnfree) then + (pkg: elem (getName pkg) (allowUnfree ++ config.dotfield.nixpkgs.allowedUnfreePackages)) + else + (_: true); + }; + }; +} diff --git a/users/cdom/at-tuvok.nix b/users/cdom/at-tuvok.nix new file mode 100644 index 000000000..354c0b719 --- /dev/null +++ b/users/cdom/at-tuvok.nix @@ -0,0 +1,17 @@ +{ + imports = (import ../../home/features.nix).workstation ++ [ + ../../home/profiles/desktop/applications/microsoft-teams.nix + ../../home/profiles/development/work/default.nix + ../../home/profiles/gpg/with-ssh-support.nix + ../../home/profiles/shells/fish/trampoline.nix + ../../home/profiles/shells/fish/with-fifc-completion.nix + ../../home/profiles/shells/prompts/starship/default.nix + + { + # The trackpad on this device is huge, and I always end up touching + # its corner with my palm, which is very disruptive. + dconf.settings."org/gnome/desktop/peripherals/touchpad".tap-to-click = false; + } + ]; + home.stateVersion = "23.05"; +} diff --git a/users/nixos/default.nix b/users/nixos/default.nix deleted file mode 100644 index 1f403836f..000000000 --- a/users/nixos/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ features, ... }: -{ - users.users.nixos = { - password = "nixos"; - description = "default"; - isNormalUser = true; - extraGroups = [ "wheel" ]; - }; - - home-manager.users.nixos = hmArgs: { imports = with hmArgs.features; graphical; }; -}