dotfiles
My PC Dotfiles & Websitegit clone https://github.com/maydayv7/dotfiles
commit f63620c0e9316e3c4fa8dd555ca926e612588d49 parent 51f102dae1469e15f2760c806daf616c36216c32 Author: maydayv7 <maydayv7@gmail.com> Date: Sat, 18 Nov 2023 16:59:34 +0530 refactor!: Use `flake-parts` + Modularize `flake.nix` + Import `self.lib` as `util` + Refactor Libraries
Diffstat:
| D | .templates/default.nix | | | 27 | --------------------------- |
| A | .templates/flake.nix | | | 29 | +++++++++++++++++++++++++++++ |
| M | README.md | | | 19 | ++++++++++--------- |
| D | configuration.nix | | | 113 | ------------------------------------------------------------------------------- |
| M | devices/README.md | | | 2 | +- |
| M | devices/Vortex/secrets/default.nix | | | 4 | ++-- |
| A | devices/flake.nix | | | 37 | +++++++++++++++++++++++++++++++++++++ |
| D | files/default.nix | | | 99 | ------------------------------------------------------------------------------- |
| A | files/flake.nix | | | 106 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| M | flake.lock | | | 65 | ++++++++++++++++++++++++++--------------------------------------- |
| M | flake.nix | | | 114 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------- |
| M | lib/README.md | | | 7 | ++++--- |
| M | lib/build.nix | | | 27 | ++++----------------------- |
| M | lib/default.nix | | | 14 | ++------------ |
| M | lib/map.nix | | | 32 | +++++++++++++++++++++++--------- |
| M | lib/pack.nix | | | 3 | ++- |
| M | modules/apps/default.nix | | | 8 | ++++++-- |
| M | modules/apps/discord.nix | | | 16 | ++++++++++------ |
| M | modules/apps/firefox.nix | | | 4 | ++-- |
| M | modules/apps/vscode.nix | | | 4 | ++-- |
| M | modules/apps/wine.nix | | | 10 | ++++++++-- |
| M | modules/base/default.nix | | | 4 | ++-- |
| A | modules/configuration.nix | | | 157 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| D | modules/default.nix | | | 163 | ------------------------------------------------------------------------------- |
| A | modules/flake.nix | | | 4 | ++++ |
| M | modules/gui/default.nix | | | 3 | ++- |
| M | modules/gui/desktop/gnome.nix | | | 3 | ++- |
| M | modules/gui/desktop/xfce.nix | | | 3 | ++- |
| M | modules/hardware/default.nix | | | 8 | ++++++-- |
| M | modules/nix/checks.nix | | | 28 | +++++----------------------- |
| M | modules/nix/default.nix | | | 3 | ++- |
| M | modules/shell/default.nix | | | 3 | ++- |
| M | modules/user/default.nix | | | 4 | ++-- |
| M | modules/user/security.nix | | | 3 | ++- |
| M | packages/dotfiles.nix | | | 2 | +- |
| A | packages/flake.nix | | | 57 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| M | packages/wine/7zip.nix | | | 4 | ++-- |
| M | scripts/nixos.nix | | | 3 | ++- |
| M | secrets/default.nix | | | 7 | +++---- |
| A | shells/flake.nix | | | 19 | +++++++++++++++++++ |
| M | users/default.nix | | | 3 | ++- |
41 files changed, 631 insertions(+), 590 deletions(-)
diff --git a/.templates/default.nix b/.templates/default.nix @@ -1,27 +0,0 @@ -lib: let - inherit (lib.filters) filter matchExt; -in { - ## Configuration Templates ## - default = { - description = "Simple, Minimal NixOS Configuration"; - path = filter { - root = ./minimal; - include = [(matchExt "nix")]; - }; - }; - - extensive = { - description = "My Complete, Extensive NixOS Configuration"; - path = filter { - root = ../.; - exclude = [ - ./.github - ./.gitlab - ./site - ./packages/website.nix - (matchExt "md") - (matchExt "secret") - ]; - }; - }; -} diff --git a/.templates/flake.nix b/.templates/flake.nix @@ -0,0 +1,29 @@ +{inputs, ...}: { + flake.templates = let + inherit (inputs.filters.lib) filter matchExt; + in { + ## Configuration Templates ## + default = { + description = "Simple, Minimal NixOS Configuration"; + path = filter { + root = ./minimal; + include = [(matchExt "nix")]; + }; + }; + + extensive = { + description = "My Complete, Extensive NixOS Configuration"; + path = filter { + root = ../.; + exclude = [ + ./.github + ./.gitlab + ./site + ./packages/website.nix + (matchExt "md") + (matchExt "secret") + ]; + }; + }; + }; +} diff --git a/README.md b/README.md @@ -110,13 +110,10 @@ github:maydayv7/dotfiles │ ├───shell: NixOS module │ └───user: NixOS module ├───overlays -│ ├───discord: Nixpkgs overlay -│ ├───gnome-terminal: Nixpkgs overlay -│ ├───google-chrome: Nixpkgs overlay │ └───miscellaneous: Nixpkgs overlay ├───packages │ └───x86_64-linux -│ ├───dotfiles: package 'Dotfiles-v13.0' +│ ├───dotfiles: package 'Dotfiles-v15.0' │ ├───nixos: package 'nixos' │ └───website: package 'website-stable' ├───templates @@ -132,8 +129,7 @@ github:maydayv7/dotfiles </details> ``` -┌── configuration.nix -├── flake.nix +┌── flake.nix ├── flake.lock ├── .templates ├── files @@ -154,6 +150,7 @@ github:maydayv7/dotfiles │ ├── map.nix │ └── pack.nix └── modules + ├── configuration.nix ├── apps ├── base ├── gui @@ -164,8 +161,9 @@ github:maydayv7/dotfiles └── passwords ``` -- `configuration.nix`: main system configuration file -- `flake.nix`: repository version control using `inputs` +- `flake.nix`: toplevel configuration file and repository version control + [`flake-parts`](https://github.com/hercules-ci/flake-parts) is used for modularization + - `.templates`: custom Flakes configuration templates - [`files`](./files/README.md): `dotfiles` and program configuration - [`secrets`](./secrets/README.md): authentication credentials management using [`sops-nix`](https://github.com/Mic92/sops-nix) @@ -181,6 +179,7 @@ github:maydayv7/dotfiles - `overlays`: overrides for pre-built packages - [`lib`](./lib/README.md): custom functions designed for conveniently defining configuration - [`modules`](./modules/README.md): custom configuration modules for additional functionality +- `configuration.nix`: builds system configuration as part of `lib.build` ## Installation @@ -350,6 +349,7 @@ The [`home-manager`](https://github.com/nix-community/home-manager) module is us - [Neofetch](https://github.com/dylanaraps/neofetch): Snazzy CLI System Information Tool - [Powerlevel10K](https://github.com/romkatv/powerlevel10k) Theme: ZSH Theme for the fancy-looking prompt with immense customization capabilities - [Arc Theme](https://github.com/jnsh/arc-theme): Flat GTK theme with transparent elements for various desktop shells, window managers and applications +- [Bibata Cursor](https://github.com/ful1e5/Bibata_Cursor): Compact and material designed cursor set - [DNOME](https://github.com/GeopJr/DNOME) Discord Theme: Discord theme inspired by Adwaita, designed to integrate Discord with GNOME - [Firefox GNOME Theme](https://github.com/rafaelmardojai/firefox-gnome-theme): GNOME Theme for the Mozilla Firefox Browser, used for better desktop integration - [VS Code Adwaita Theme](https://github.com/piousdeer/vscode-adwaita): Integrates Visual Studio Code with GNOME Desktop @@ -413,8 +413,9 @@ You can navigate to the `README`s present in the various directories to know mor <details> <summary><b>Changelog</b></summary> -### vNEXT +### v15 +- Use the [`flake-parts`](https://flake.parts/) Flakes framework - Fix Emoji Support - Miscellaneous Updates - Support declarative [Flatpak](https://flatpak.org/) application install diff --git a/configuration.nix b/configuration.nix @@ -1,113 +0,0 @@ -{self, ...} @ inputs: let - ## Variable Declaration ## - # Supported Architectures - systems = import inputs.systems; - - # System Libraries - inherit (self) files; - inherit (lib.util) build map pack; - lib = with inputs; - nixpkgs.lib.extend (final: prev: - { - filters = ignore.lib // {inherit (filter.lib) filter matchExt;}; - hooks = hooks.lib; - image = generators.nixosGenerate; - wine = wine.lib; - } - // { - util = import ./lib { - inherit self systems; - lib = final; - }; - } - // home.lib - // utils.lib); -in - lib.eachSystem systems (system: let - # Default Package Channel - pkgs = self.legacyPackages."${system}"; - - # Package Calling Function - call = name: pkgs.callPackage name {inherit lib inputs pkgs files;}; - in { - ## Configuration Checks ## - checks = import ./modules/nix/checks.nix {inherit self system lib;}; - - ## Developer Shells ## - devShells = - map.modules' ./shells (file: pkgs.mkShell (import file pkgs)) - // { - default = import ./shells {inherit pkgs;}; - website = import ./site/shell.nix {inherit pkgs;}; - commit = - pkgs.mkShell {inherit (self.checks."${system}".commit) shellHook;}; - }; - - ## Code Formatter ## - formatter = pkgs.treefmt; - - ## Package Configuration ## - legacyPackages = self.channels."${system}".nixpkgs; - - # Package Channels - channels = with inputs; { - nixpkgs = (build.channel nixpkgs [nur.overlay])."${system}"; - wine = wine.packages."${system}"; - gaming = gaming.packages."${system}"; - generators = generators.packages."${system}".default; - }; - - # Custom Packages - apps = - map.modules ./scripts (name: lib.mkApp {drv = call name;}) - // {default = self.apps."${system}".nixos;}; - packages = - map.modules ./packages call - // map.modules ./scripts call - // {default = self.packages."${system}".dotfiles;} - // inputs.proprietary.packages."${system}"; - }) - // { - # Overrides - overlays = map.modules ./packages/overlays import; - - ## Custom Library Functions ## - lib = - lib.util - // { - inherit systems; - nixpkgs = inputs.nixpkgs.lib; - }; - - ## Program Configuration and 'dotfiles' ## - files = import ./files lib inputs; - - ## Custom Configuration Modules ## - nixosModules = - map.modules ./modules import - // {default = import ./modules {inherit lib inputs files;};}; - - ## Configuration Templates ## - templates = import ./.templates lib; - - ## Device Configuration ## - nixosConfigurations = map.modules ./devices (name: build.device (import name)); - - ## Virtual Machines ## - vmConfigurations = - map.modules ./devices/vm - (name: import name inputs.windows.lib self.legacyPackages."${builtins.head systems}"); - - ## Install Media Configuration ## - installMedia = let - config = { - timezone = "Asia/Kolkata"; - locale = "IN"; - kernel = "zfs"; - }; - in rec { - default = xfce; - gnome = build.iso (config // {gui.desktop = "gnome";}); - xfce = build.iso (config // {gui.desktop = "xfce";}); - }; - } diff --git a/devices/README.md b/devices/README.md @@ -1,6 +1,6 @@ ### Devices -The `devices` directory contains the core definitions for multiple PCs and various other devices. To add a new device, simply create a configuration file for it (name of the file/directory must be the same as the `hostname` of the device) and write down the configuration using the options of the desired modules from the [`modules`](../modules/README.md) directory, or add your own configuration modules using the `imports` keyword. You can also use the keyword `format` to generate a particular type of image for that device (Eg. `iso`, generated using [`nixos-generators`](https://github.com/nix-community/nixos-generators)). Use the `repo` keyword to specify the main package repository to be used (see [`self.channels.${system}`](../configuration.nix)). Optionally, add user-specific configuration in [`users`](../users/README.md). Then, run the command `nixos-rebuild switch --flake .#HOSTNAME` and let Nix do all the work for you! +The `devices` directory contains the core definitions for multiple PCs and various other devices. To add a new device, simply create a configuration file for it (name of the file/directory must be the same as the `hostname` of the device) and write down the configuration using the options of the desired modules from the [`modules`](../modules/README.md) directory, or add your own configuration modules using the `imports` keyword. You can also use the keyword `format` to generate a particular type of image for that device (Eg. `iso`, generated using [`nixos-generators`](https://github.com/nix-community/nixos-generators)). Optionally, add user-specific configuration in [`users`](../users/README.md). Then, run the command `nixos-rebuild switch --flake .#HOSTNAME` and let Nix do all the work for you! #### Additional Options diff --git a/devices/Vortex/secrets/default.nix b/devices/Vortex/secrets/default.nix @@ -1,4 +1,4 @@ -{lib, ...}: { +{util, ...}: { ## System Secrets ## - config.sops.secrets = lib.util.map.secrets ./. false; + config.sops.secrets = util.map.secrets ./. false; } diff --git a/devices/flake.nix b/devices/flake.nix @@ -0,0 +1,37 @@ +{ + util, + inputs, + ... +}: let + inherit (inputs) self; + inherit (util) build map pack; + inherit (builtins) head; +in { + flake = { + ## Device Configuration ## + nixosConfigurations = map.modules ./. (name: build.device (import name)); + + ## Virtual Machines ## + vmConfigurations = with self; + map.modules ./vm + (name: import name inputs.windows.lib legacyPackages."${head systems}"); + + ## Install Media Configuration ## + installMedia = let + config = { + timezone = "Asia/Kolkata"; + locale = "IN"; + kernel = "zfs"; + }; + in rec { + default = xfce; + gnome = build.iso (config // {gui.desktop = "gnome";}); + xfce = build.iso (config // {gui.desktop = "xfce";}); + }; + }; + + # Install Media Checks + perSystem = {system, ...}: { + checks = pack.device self.installMedia "nixos-rebuild"; + }; +} diff --git a/files/default.nix b/files/default.nix @@ -1,99 +0,0 @@ -lib: inputs: let - inherit (lib.util) build map; - inherit (builtins) fromJSON readFile; -in rec { - ## Dotfiles ## - # File Paths - path = { - toplevel = ./.; - system = "/etc/nixos"; - cache = "maydayv7-dotfiles"; - flake = "github:maydayv7/dotfiles"; - repo = "https://github.com/maydayv7/dotfiles"; - }; - - # ASCII Art - ascii = map.files' ./ascii lib.id ""; - - # Base16 Color Schemes - colors = map.files ./colors lib.id ".yaml"; - - # Neofetch - fetch = readFile ./neofetch/config.conf; - - # Firefox Web Browser - firefox.theme = readFile ./firefox/userContent.css; - - # 'git' Version Control - git.hooks = ./git/hooks; - - # GNOME Desktop - gnome = - { - dconf = ./gnome/dconf.nix; - iso = readFile ./gnome/iso; - tiling = ./gnome/tiling.css; - } - // map.files ./gnome lib.id ".json"; - - # GPG Keys Directory - gpg = "/etc/gpg"; - - # GTK+ Settings - gtk.bookmarks = readFile ./gtk/bookmarks; - - # Pictures - images.profile = ./images/Profile.png; - - # Persisted Files - persist = "/nix/state"; - - # Plank Dock - plank = { - autostart = readFile ./plank/dock.desktop; - launchers = ./plank/launchers; - theme = readFile ./plank/dock.theme; - }; - - # Custom Proprietary Files - proprietary = inputs.proprietary.files; - inherit (proprietary) wallpapers; - - # Nano Text Editor - nano = readFile ./nano/nanorc; - - # Interactive Nix Shell - repl = ../repl.nix; - - # Bash Scripts - scripts = map.files ../scripts build.script ".sh"; - - # 'sops' Encrypted Secrets - sops = ../secrets/.sops.yaml; - - # Document Templates - templates = ./templates; - - # Visual Studio Code Editor - vscode = map.files ./vscode (file: fromJSON (readFile file)) ".json"; - - # XDG Settings - xdg.mime = import ./xdg/mime.nix; - - # XFCE Desktop - xfce = { - css = readFile ./xfce/gtk.css; - panel = ./xfce/panel; - terminal = readFile ./xfce/terminalrc; - settings = ./xfce/settings; - }; - - # My Personal Website - website = ../site; - - # XORG Display Server - xorg = readFile ./xorg/Xresources; - - # Z Shell - zsh.prompt = readFile ./zsh/p10k.zsh; -} diff --git a/files/flake.nix b/files/flake.nix @@ -0,0 +1,106 @@ +{ + lib, + util, + inputs, + ... +}: { + ## Program Configuration and 'dotfiles' ## + flake.files = let + inherit (util) build map; + inherit (builtins) fromJSON readFile; + in rec { + # File Paths + path = { + toplevel = ./.; + system = "/etc/nixos"; + cache = "maydayv7-dotfiles"; + flake = "github:maydayv7/dotfiles"; + repo = "https://github.com/maydayv7/dotfiles"; + }; + + # ASCII Art + ascii = map.files' ./ascii lib.id ""; + + # Base16 Color Schemes + colors = map.files ./colors lib.id ".yaml"; + + # Neofetch + fetch = readFile ./neofetch/config.conf; + + # Firefox Web Browser + firefox.theme = readFile ./firefox/userContent.css; + + # 'git' Version Control + git.hooks = ./git/hooks; + + # GNOME Desktop + gnome = + { + dconf = ./gnome/dconf.nix; + iso = readFile ./gnome/iso; + tiling = ./gnome/tiling.css; + } + // map.files ./gnome lib.id ".json"; + + # GPG Keys Directory + gpg = "/etc/gpg"; + + # GTK+ Settings + gtk.bookmarks = readFile ./gtk/bookmarks; + + # Pictures + images.profile = ./images/Profile.png; + + # Persisted Files + persist = "/nix/state"; + + # Plank Dock + plank = { + autostart = readFile ./plank/dock.desktop; + launchers = ./plank/launchers; + theme = readFile ./plank/dock.theme; + }; + + # Custom Proprietary Files + proprietary = inputs.proprietary.files; + inherit (proprietary) wallpapers; + + # Nano Text Editor + nano = readFile ./nano/nanorc; + + # Interactive Nix Shell + repl = ../repl.nix; + + # Bash Scripts + scripts = map.files ../scripts build.script ".sh"; + + # 'sops' Encrypted Secrets + sops = ../secrets/.sops.yaml; + + # Document Templates + templates = ./templates; + + # Visual Studio Code Editor + vscode = map.files ./vscode (file: fromJSON (readFile file)) ".json"; + + # XDG Settings + xdg.mime = import ./xdg/mime.nix; + + # XFCE Desktop + xfce = { + css = readFile ./xfce/gtk.css; + panel = ./xfce/panel; + terminal = readFile ./xfce/terminalrc; + settings = ./xfce/settings; + }; + + # My Personal Website + website = ../site; + + # XORG Display Server + xorg = readFile ./xorg/Xresources; + + # Z Shell + zsh.prompt = readFile ./zsh/p10k.zsh; + }; +} diff --git a/flake.lock b/flake.lock @@ -130,7 +130,7 @@ "type": "github" } }, - "filter": { + "filters": { "locked": { "lastModified": 1694857738, "narHash": "sha256-bxxNyLHjhu0N8T3REINXQ2ZkJco0ABFPn6PIe2QUfqo=", @@ -193,24 +193,6 @@ "type": "github" } }, - "flake-parts": { - "inputs": { - "nixpkgs-lib": "nixpkgs-lib" - }, - "locked": { - "lastModified": 1698882062, - "narHash": "sha256-HkhafUayIqxXyHH1X8d9RDl1M2CkFgZLjKD3MzabiEo=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "8c9fa2545007b49a5db5f650ae91f227672c3877", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, "flake-utils": { "inputs": { "systems": "systems_3" @@ -244,6 +226,26 @@ "type": "github" } }, + "framework": { + "inputs": { + "nixpkgs-lib": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1698882062, + "narHash": "sha256-HkhafUayIqxXyHH1X8d9RDl1M2CkFgZLjKD3MzabiEo=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8c9fa2545007b49a5db5f650ae91f227672c3877", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "fromYaml": { "flake": false, "locked": { @@ -262,7 +264,9 @@ }, "gaming": { "inputs": { - "flake-parts": "flake-parts", + "flake-parts": [ + "framework" + ], "nixpkgs": "nixpkgs" }, "locked": { @@ -448,24 +452,6 @@ "type": "github" } }, - "nixpkgs-lib": { - "locked": { - "dir": "lib", - "lastModified": 1698611440, - "narHash": "sha256-jPjHjrerhYDy3q9+s5EAsuhyhuknNfowY6yt6pjn9pc=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "0cbe9f69c234a7700596e943bfae7ef27a31b735", - "type": "github" - }, - "original": { - "dir": "lib", - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs-stable": { "locked": { "lastModified": 1685801374, @@ -597,8 +583,9 @@ }, "root": { "inputs": { - "filter": "filter", + "filters": "filters", "flatpak": "flatpak", + "framework": "framework", "gaming": "gaming", "generators": "generators", "hardware": "hardware", diff --git a/flake.nix b/flake.nix @@ -23,7 +23,7 @@ # Author -> V 7 <maydayv7@gmail.com> # # License -> MIT # # URL -> github:maydayv7/dotfiles # -# Version -> v13 # +# Version -> v15 # # --------------------------------------- # # Welcome to Ground Zero! # # The Very Heart of my 'dotfiles' # @@ -34,32 +34,7 @@ Multi-PC NixOS Configuration and 'dotfiles' ''; - ## Nix Configuration ## - nixConfig = { - commit-lockfile-summary = "chore(flake.lock): Update `inputs`"; - - # Binary Caches - substituters = [ - "https://cache.nixos.org" - "https://nix-community.cachix.org" - "https://nixpkgs-unfree.cachix.org" - "https://nix-gaming.cachix.org" - "https://pre-commit-hooks.cachix.org" - "https://maydayv7-dotfiles.cachix.org" - ]; - - # Public Keys - trusted-public-keys = [ - "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - "nixpkgs-unfree.cachix.org-1:hqvoInulhbV4nJ9yJOEr+4wxhDV4xq2d1DK7S6Nj6rs=" - "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" - "pre-commit-hooks.cachix.org-1:Pkk3Panw5AW24TOv6kz3PvLhlH8puAsJTBbOPmBo7Rc=" - "maydayv7-dotfiles.cachix.org-1:dpECO0Z2ZMttY6JgWHuAR5M7cqeyfFjUsvHdnMz+j6U=" - ]; - }; - - ## System Repositories ## + ## Repositories ## inputs = { ## Package Repositories ## # NixOS Packages Repository @@ -72,7 +47,10 @@ proprietary.url = "github:maydayv7/proprietary"; # Packaged Games - gaming.url = "github:fufexan/nix-gaming"; + gaming = { + url = "github:fufexan/nix-gaming"; + inputs.flake-parts.follows = "framework"; + }; ## Configuration Modules ## ## Language Addendum @@ -82,6 +60,12 @@ flake = false; }; + # Flakes Framework + framework = { + url = "github:hercules-ci/flake-parts"; + inputs.nixpkgs-lib.follows = "nixpkgs"; + }; + # Flake Utility Functions utils = { url = "github:gytis-ivaskevicius/flake-utils-plus"; @@ -89,7 +73,7 @@ }; # Source Filter Functions - filter.url = "github:numtide/nix-filter"; + filters.url = "github:numtide/nix-filter"; ignore = { url = "github:hercules-ci/gitignore.nix"; inputs.nixpkgs.follows = "nixpkgs"; @@ -155,6 +139,74 @@ }; }; - ## System Configuration ## - outputs = args: import ./configuration.nix args; + ## Configuration ## + outputs = {self, ...} @ inputs: let + inherit (inputs.nixpkgs) lib; + in + inputs.framework.lib.mkFlake {inherit inputs;} { + inherit (self) systems; + debug = false; + + _module.args = {util = self.lib;}; + imports = (import ./lib/map.nix {inherit lib;}).flake ./.; + + flake = { + # Supported Architectures + systems = import inputs.systems; + + ## Custom Library Functions + lib = import ./lib { + inherit lib inputs; + }; + }; + + perSystem = { + system, + pkgs, + ... + }: { + # Code Formatter + formatter = pkgs.treefmt; + + # Pre-Commit Hooks + checks = with inputs; { + commit = hooks.lib."${system}".run { + src = ignore.lib.gitignoreSource ./.; + settings.statix.ignore = ["_*"]; + hooks = { + alejandra.enable = true; + prettier.enable = true; + shellcheck.enable = false; + statix.enable = true; + stylua.enable = true; + }; + }; + }; + }; + }; + + ## Nix Configuration ## + nixConfig = { + commit-lockfile-summary = "chore(flake.lock): Update `inputs`"; + + # Binary Caches + substituters = [ + "https://cache.nixos.org" + "https://nix-community.cachix.org" + "https://nixpkgs-unfree.cachix.org" + "https://nix-gaming.cachix.org" + "https://pre-commit-hooks.cachix.org" + "https://maydayv7-dotfiles.cachix.org" + ]; + + # Public Keys + trusted-public-keys = [ + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + "nixpkgs-unfree.cachix.org-1:hqvoInulhbV4nJ9yJOEr+4wxhDV4xq2d1DK7S6Nj6rs=" + "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" + "pre-commit-hooks.cachix.org-1:Pkk3Panw5AW24TOv6kz3PvLhlH8puAsJTBbOPmBo7Rc=" + "maydayv7-dotfiles.cachix.org-1:dpECO0Z2ZMttY6JgWHuAR5M7cqeyfFjUsvHdnMz+j6U=" + ]; + }; } diff --git a/lib/README.md b/lib/README.md @@ -1,15 +1,14 @@ ### Custom Library Functions -The `lib` directory contains custom-made pure Flakes-compatible utility functions (exposed as `lib.util`), created in order to simplify the configuration and conveniently define and support multiple use-cases (If you have a working NixOS install, you can check it out using `github:maydayv7/dotfiles#lib`). The following is a summary of all the present functions: +The `lib` directory contains custom-made utility functions (exposed as `util`), created in order to simplify the configuration and conveniently define and support multiple use-cases (If you have a working NixOS install, you can check it out using `github:maydayv7/dotfiles#lib`). The following is a summary of all the present functions: -[`lib.util`](./default.nix) - +[`util`](./default.nix) - - [`build`](./build.nix): Configuration building functions for efficient system management and declaration - - `device`: Main system configuration building function, used to build the entire configuration for devices (`nixosConfigurations`) as per provided parameters - `iso`: configuration building function used to build the entire configuration for install media (`installMedia`) as per provided parameters - `each`: Maps function for each `attr` as passed - - `channel`: Builds package `channels` for desired `inputs` with specified `overlays` for each `system`, and optionally patches the `input` - `mime`: Builds and sets `mimetype` values according to specified application and types - `script`: Builds script from specified file by removing `shebangs` and exporting as a _string_ @@ -17,11 +16,13 @@ The `lib` directory contains custom-made pure Flakes-compatible utility function - `array`: Maps required parameter to all elements present in `list` - `checkAttr`: Checks if file contains an attrset + - `checkName`: Checks if file to be mapped has a valid name - `filter`: Filters out unneeded `attrs` and maps required ones to specified function - `list`: Lists all toplevel `attrs` of `attrset` and returns a space-separated string - `file`: Maps all files with a particular extension adhering to a particular condition stored in a directory as an `attrset` acted upon by specified function. Use `file'` in order to recursively search inside directories - `files`: Same as `file` but without additional conditional - `patches`: Maps all file patches stored in a directory, if available + - `flake`: Maps all subflakes stored in a directory into a list for easy import - `module`: Maps all configuration files stored in a directory into a list for easy import. Use `module'` in order to map file names instead of paths - `modules`: Maps all configuration modules stored in a directory as an `attrset` acted upon by specified function. Use `modules'` in order to recursively search inside directories - `secrets`: Maps binary `sops` encrypted secrets stored in a directory diff --git a/lib/build.nix b/lib/build.nix @@ -1,18 +1,17 @@ { - self, - systems, lib, + inputs, ... }: let - inherit (builtins) attrValues concatStringsSep filter hasAttr listToAttrs map readFile; - inherit (lib) flatten hasPrefix mapAttrsToList mkForce nameValuePair recursiveUpdate splitString; + inherit (lib) flatten hasPrefix mapAttrsToList mkForce nameValuePair splitString; + inherit (builtins) concatStringsSep filter hasAttr listToAttrs map readFile; in rec { ## Builder Functions ## each = attr: func: listToAttrs (map (name: nameValuePair name (func name)) attr); # Configuration Builders - device = self.nixosModules.default.config; + device = (import ../modules/configuration.nix {inherit lib inputs;}).build; iso = config: device (config // { @@ -32,24 +31,6 @@ in rec { }; }); - # Package Channels Builder - channel = src: overlays: - each systems (system: let - pkgs = src.legacyPackages."${system}"; - in - import src { - inherit system; - config = import ../modules/nix/config.nix; - overlays = - overlays - ++ (attrValues self.overlays or {}) - ++ [ - (final: prev: - recursiveUpdate {custom = self.packages."${system}";} - self.channels."${system}") - ]; - }); - # Mime Types Handler mime = values: option: listToAttrs (flatten (mapAttrsToList (name: types: diff --git a/lib/default.nix b/lib/default.nix @@ -1,12 +1,2 @@ -{ - self, - systems, - lib, -} @ args: let - inherit (lib) makeExtensible attrValues foldr; -in - (makeExtensible (final: - with final; - (import ./map.nix args).modules ./. (file: import file args))) - .extend - (final: prev: foldr (x: y: x // y) {} (attrValues prev)) +args: +(import ./map.nix args).modules ./. (file: import file args) diff --git a/lib/map.nix b/lib/map.nix @@ -36,7 +36,7 @@ in rec { # Top Level files = dir: func: ext: file dir func ext (_: true); file = dir: func: ext: cond: - filter (name: type: type != null && !(hasPrefix "_" name)) (name: type: let + filter checkName (name: type: let path = "${toString dir}/${name}"; in if @@ -52,7 +52,7 @@ in rec { == "regular" && ( if (ext == ".nix") - then name != "default.nix" + then name != "default.nix" && name != "flake.nix" else true ) && hasSuffix ext name @@ -63,7 +63,7 @@ in rec { # Recursive files' = dir: func: ext: file' dir func ext (_: true); file' = dir: func: ext: cond: - filter (name: type: type != null && !(hasPrefix "_" name)) (name: type: let + filter checkName (name: type: let path = "${toString dir}/${name}"; in if (type == "directory" || type == "symlink") @@ -73,7 +73,7 @@ in rec { == "regular" && ( if (ext == ".nix") - then name != "default.nix" + then name != "default.nix" && name != "flake.nix" else true ) && hasSuffix ext name @@ -81,6 +81,13 @@ in rec { then nameValuePair (removeSuffix ext name) (func path) else nameValuePair "" null) (readDir dir); + # Import Checks + checkName = name: type: type != null && !(hasPrefix "_" name); + checkAttr = name: let + file = import name; + in + typeOf file == "set" || typeOf file == "lambda"; + # Package Patches patches = patch: if isPath patch @@ -94,11 +101,18 @@ in rec { else null) (readDir patch)) else patch; + # Flake Imports + flake = dir: + attrValues (filter checkName (name: type: let + path = "${toString dir}/${name}"; + in + if + (type == "directory" || type == "symlink") + && (pathExists "${path}/flake.nix") + then nameValuePair name "${path}/flake.nix" + else nameValuePair "" null) (readDir dir)); + # Module Imports - checkAttr = name: let - file = import name; - in - typeOf file == "set" || typeOf file == "lambda"; module = dir: attrValues (modules dir id); module' = dir: attrNames (modules dir id); modules = dir: func: file dir func ".nix" checkAttr; @@ -106,7 +120,7 @@ in rec { # 'sops' Encrypted Secrets secrets = dir: neededForUsers: - filter (name: type: type != null && !(hasPrefix "_" name)) (name: type: + filter checkName (name: type: if type == "regular" && hasSuffix ".secret" name then nameValuePair name { diff --git a/lib/pack.nix b/lib/pack.nix @@ -1,8 +1,9 @@ { - self, lib, + inputs, ... }: let + inherit (inputs) self; inherit (builtins) attrNames; inherit (lib) genAttrs id mapAttrs'; in rec { diff --git a/modules/apps/default.nix b/modules/apps/default.nix @@ -1,5 +1,9 @@ -{lib, ...}: let - inherit (lib) mkOption types util; +{ + lib, + util, + ... +}: let + inherit (lib) mkOption types; in { imports = util.map.module ./.; diff --git a/modules/apps/discord.nix b/modules/apps/discord.nix @@ -13,18 +13,22 @@ in { user = { persist.directories = [".config/BetterDiscord" ".config/discord"]; - home.home = { + home = { # Plugins - file.".config/BetterDiscord/plugins" = { + home.file.".config/BetterDiscord/plugins" = { source = files.proprietary.discord; recursive = true; }; # Discord Activation - activation.discordSetup = lib.hm.dag.entryAfter ["writeBoundary"] '' - echo "Setting up Discord..." - $DRY_RUN_CMD /usr/bin/env betterdiscordctl $VERBOSE_ARG install || true - ''; + imports = [ + ({lib, ...}: { + home.activation.discordSetup = lib.hm.dag.entryAfter ["writeBoundary"] '' + echo "Setting up Discord..." + $DRY_RUN_CMD /usr/bin/env betterdiscordctl $VERBOSE_ARG install || true + ''; + }) + ]; }; }; }; diff --git a/modules/apps/firefox.nix b/modules/apps/firefox.nix @@ -1,15 +1,15 @@ { config, lib, + util, pkgs, files, ... }: let - inherit (lib) mkIf util; enable = builtins.elem "firefox" config.apps.list; in { ## Firefox Browser Configuration ## - config = mkIf enable { + config = lib.mkIf enable { environment = { systemPackages = [pkgs.firefox]; sessionVariables.MOZ_USE_XINPUT2 = "1"; diff --git a/modules/apps/vscode.nix b/modules/apps/vscode.nix @@ -1,19 +1,19 @@ { config, lib, + util, inputs, pkgs, files, ... }: with files.vscode; let - inherit (lib) mkIf util; inherit (builtins) elem head; enable = elem "vscode" config.apps.list; font = head config.fonts.fontconfig.defaultFonts.monospace; in { ## Visual Studio Code Editor Configuration ## - config = mkIf enable { + config = lib.mkIf enable { environment.systemPackages = with pkgs; [rnix-lsp vscode]; user = { diff --git a/modules/apps/wine.nix b/modules/apps/wine.nix @@ -1,11 +1,13 @@ { config, lib, + util, + inputs, pkgs, ... }: let inherit (builtins) attrValues elem map; - inherit (lib) mkIf mkOption types util; + inherit (lib) mkIf mkOption types; enable = elem "wine" config.apps.list; wine = config.apps.wine.package; in { @@ -45,6 +47,10 @@ in { ] # Wrapped Packages ++ attrValues (util.map.modules ../../packages/wine - (name: pkgs.callPackage name {inherit lib pkgs wine;})); + (name: + pkgs.callPackage name { + inherit lib pkgs wine; + build = inputs.wine.lib."${system}"; + })); }; } diff --git a/modules/base/default.nix b/modules/base/default.nix @@ -1,9 +1,9 @@ { - lib, + util, pkgs, ... }: { - imports = lib.util.map.module ./.; + imports = util.map.module ./.; ## Base Configuration ## config.documentation.nixos.enable = false; diff --git a/modules/configuration.nix b/modules/configuration.nix @@ -0,0 +1,157 @@ +{ + lib, + inputs, +}: let + inherit (inputs) self; + util = self.lib; + inherit (self) files; + + inherit (lib) extend fileContents makeOverridable mkIf; + inherit + (builtins) + attrValues + getAttr + hashString + map + removeAttrs + replaceStrings + substring + ; +in { + ## Configuration Build Function ## + build = { + system ? "x86_64-linux", + name ? "nixos", + description ? "", + format ? null, + imports ? [], + timezone, + locale, + update ? "", + kernel, + kernelModules ? [], + apps ? {}, + gui ? {}, + hardware ? {}, + nix ? {}, + shell ? {}, + user ? null, + users ? null, + }: let + # Default Package Channel + pkgs = self.legacyPackages."${system}"; + + # User Build Function + user' = { + name, + description, + uid ? 1000, + groups ? ["wheel"], + password ? "", + autologin ? false, + shell ? "bash", + shells ? [], + home ? {}, + minimal ? false, + }: { + user.settings."${name}" = { + inherit name description uid autologin minimal; + homeConfig = home; + extraGroups = groups; + hashedPassword = mkIf (password != "") password; + initialHashedPassword = mkIf (password == "") ""; + shell = pkgs."${shell}"; + shells = + if (shells == null) + then [] + else shells ++ [shell]; + }; + }; + in + # Assertions + assert (user == null) -> (users != null); + ## Device Configuration ## + (makeOverridable lib.nixosSystem) { + inherit system; + specialArgs = {inherit system util inputs files;}; + + modules = [ + { + # Modulated Configuration Imports + imports = + imports + ++ (attrValues (removeAttrs self.nixosModules ["default"])) + ++ map user' ( + if (user != null) + then [user] + else users + ) + ++ ( + if (format != null) + then [(getAttr format inputs.generators.nixosModules)] + else [] + ) + ++ util.map.array (hardware.modules or []) inputs.hardware.nixosModules; + inherit apps gui hardware shell; + + # Device Name + networking = { + hostName = name; + hostId = substring 0 8 (hashString "md5" name); + }; + + # Localization + time.timeZone = timezone; + i18n.defaultLocale = "en_${locale}"; + + # Kernel Configuration + boot = { + initrd.availableKernelModules = + if (kernelModules != null) + then kernelModules ++ ["ahci" "sd_mod" "usbhid" "usb_storage" "xhci_pci"] + else []; + kernelPackages = + if (kernel == "zfs") + then pkgs.zfs.latestCompatibleLinuxPackages + else pkgs.linuxKernel.packages."${"linux_" + kernel}"; + }; + + # Package Configuration + nixpkgs = {inherit pkgs;}; + nix = + { + settings.max-jobs = hardware.cores or 4; + } + // nix; + + system = { + # Updates + autoUpgrade = { + enable = mkIf (update != "") true; + dates = mkIf (update != "") update; + inherit (files.path) flake; + }; + + switch.enable = + if (format != null) + then false + else true; + + # Version + stateVersion = fileContents "${inputs.nixpkgs}/.version"; + configurationRevision = + if (self ? rev) + then self.rev + else null; + name = "${name}-${replaceStrings [" "] ["_"] description}"; + nixos.label = + if (self ? rev) + then "${substring 0 8 self.lastModifiedDate}.${self.shortRev}" + else if (self ? dirtyRev) + then self.dirtyShortRev + else "dirty"; + }; + } + ]; + }; +} diff --git a/modules/default.nix b/modules/default.nix @@ -1,163 +0,0 @@ -{ - lib, - inputs, - files, -}: let - inherit (inputs) self generators; - inherit (lib) extend fileContents makeOverridable mkIf; - inherit - (builtins) - attrValues - getAttr - hashString - map - removeAttrs - replaceStrings - substring - ; -in { - ## Configuration Build Function ## - config = { - system ? "x86_64-linux", - name ? "nixos", - description ? "", - format ? null, - imports ? [], - timezone, - locale, - update ? "", - kernel, - kernelModules ? [], - apps ? {}, - gui ? {}, - hardware ? {}, - nix ? {}, - shell ? {}, - user ? null, - users ? null, - }: let - # Default Package Channel - pkgs = self.legacyPackages."${system}"; - - # System Libraries - inherit (lib') util; - lib' = - extend (final: prev: with inputs.nixpkgs.lib; {inherit nixosSystem trivial;}); - - # User Build Function - user' = { - name, - description, - uid ? 1000, - groups ? ["wheel"], - password ? "", - autologin ? false, - shell ? "bash", - shells ? [], - home ? {}, - minimal ? false, - }: { - user.settings."${name}" = { - inherit name description uid autologin minimal; - homeConfig = home; - extraGroups = groups; - hashedPassword = mkIf (password != "") password; - initialHashedPassword = mkIf (password == "") ""; - shell = pkgs."${shell}"; - shells = - if (shells == null) - then [] - else shells ++ [shell]; - }; - }; - in - # Assertions - assert (user == null) -> (users != null); - ## Device Configuration ## - (makeOverridable lib'.nixosSystem) { - inherit system; - specialArgs = { - inherit system inputs files; - lib = lib'; - }; - - modules = [ - { - # Modulated Configuration Imports - imports = - imports - ++ (attrValues (removeAttrs self.nixosModules ["default"])) - ++ map user' ( - if (user != null) - then [user] - else users - ) - ++ ( - if (format != null) - then [(getAttr format generators.nixosModules)] - else [] - ) - ++ util.map.array (hardware.modules or []) inputs.hardware.nixosModules; - inherit apps gui hardware shell; - - # Device Name - networking = { - hostName = name; - hostId = substring 0 8 (hashString "md5" name); - }; - - # Localization - time.timeZone = timezone; - i18n.defaultLocale = "en_${locale}"; - - # Kernel Configuration - boot = { - initrd.availableKernelModules = - if (kernelModules != null) - then kernelModules ++ ["ahci" "sd_mod" "usbhid" "usb_storage" "xhci_pci"] - else []; - kernelPackages = - if (kernel == "zfs") - then pkgs.zfs.latestCompatibleLinuxPackages - else pkgs.linuxKernel.packages."${"linux_" + kernel}"; - }; - - # Package Configuration - nixpkgs = {inherit pkgs;}; - nix = - { - settings.max-jobs = hardware.cores or 4; - } - // nix; - - system = { - # Updates - autoUpgrade = { - enable = mkIf (update != "") true; - dates = mkIf (update != "") update; - inherit (files.path) flake; - }; - - switch.enable = - if (format != null) - then false - else true; - - # Version - stateVersion = fileContents "${inputs.nixpkgs}/.version"; - configurationRevision = - if (self ? rev) - then self.rev - else null; - name = "${name}-${replaceStrings [" "] ["_"] description}"; - nixos.label = - if (self ? rev) - then "${substring 0 8 self.lastModifiedDate}.${self.shortRev}" - else if (self ? dirtyRev) - then self.dirtyShortRev - else "dirty"; - }; - } - ]; - }; -} diff --git a/modules/flake.nix b/modules/flake.nix @@ -0,0 +1,4 @@ +{util, ...}: { + ## Custom Configuration Modules ## + flake.nixosModules = builtins.removeAttrs (util.map.modules ./. import) ["configuration"]; +} diff --git a/modules/gui/default.nix b/modules/gui/default.nix @@ -2,11 +2,12 @@ config, options, lib, + util, ... }: let inherit (builtins) map; inherit (util.map) module module'; - inherit (lib) mkOption optional types util; + inherit (lib) mkOption optional types; in { imports = module ./. ++ module ./desktop; diff --git a/modules/gui/desktop/gnome.nix b/modules/gui/desktop/gnome.nix @@ -1,6 +1,7 @@ { config, lib, + util, pkgs, files, ... @@ -9,7 +10,7 @@ with files; let inherit (builtins) elem; inherit (config.gui) desktop; apps = config.environment.systemPackages; - inherit (lib) mkIf mkForce mkMerge util; + inherit (lib) mkIf mkForce mkMerge; in { ## GNOME Desktop Configuration ## config = mkIf (desktop == "gnome" || desktop == "gnome-minimal") (mkMerge [ diff --git a/modules/gui/desktop/xfce.nix b/modules/gui/desktop/xfce.nix @@ -1,6 +1,7 @@ { config, lib, + util, pkgs, files, ... @@ -9,7 +10,7 @@ with files; let inherit (builtins) elem readFile; inherit (config.gui) desktop wallpaper; apps = config.environment.systemPackages; - inherit (lib) mapAttrs' mkIf mkForce mkMerge nameValuePair replaceStrings util; + inherit (lib) mapAttrs' mkIf mkForce mkMerge nameValuePair replaceStrings; # GTK+ Theme theme = { diff --git a/modules/hardware/default.nix b/modules/hardware/default.nix @@ -1,5 +1,9 @@ -{lib, ...}: let - inherit (lib) mkOption types util; +{ + lib, + util, + ... +}: let + inherit (lib) mkOption types; in { imports = util.map.module ./.; diff --git a/modules/nix/checks.nix b/modules/nix/checks.nix @@ -1,23 +1,5 @@ -{ - self, - system, - lib, -}: let - inherit (lib) filters hooks util; -in - # Install Media Checks - (util.pack.device self.installMedia "nixos-rebuild") - // { - # Pre-Commit Hooks - commit = hooks."${system}".run { - src = filters.gitignoreSource ../../.; - settings.statix.ignore = ["flake.nix" "_*"]; - hooks = { - alejandra.enable = true; - prettier.enable = true; - shellcheck.enable = false; - statix.enable = true; - stylua.enable = true; - }; - }; - } +{inputs, ...}: { + ## Configuration Checks ## + perSystem = {system, ...}: { + }; +} diff --git a/modules/nix/default.nix b/modules/nix/default.nix @@ -1,11 +1,12 @@ { config, lib, + util, inputs, pkgs, ... }: let - inherit (lib) mkEnableOption optionals util; + inherit (lib) mkEnableOption optionals; inherit (config.nix) tools; in { imports = [./index.nix inputs.utils.nixosModules.autoGenFromInputs]; diff --git a/modules/shell/default.nix b/modules/shell/default.nix @@ -1,12 +1,13 @@ { config, lib, + util, pkgs, files, ... }: with files; let - inherit (lib) mkEnableOption mkIf mkMerge util; + inherit (lib) mkEnableOption mkIf mkMerge; in { imports = util.map.module ./.; diff --git a/modules/user/default.nix b/modules/user/default.nix @@ -1,6 +1,7 @@ { config, lib, + util, inputs, files, ... @@ -19,7 +20,6 @@ mkOptionType optionals types - util ; # Merged Sets Type @@ -150,7 +150,7 @@ in { useUserPackages = true; backupFileExtension = "bak"; extraSpecialArgs = { - inherit lib inputs files; + inherit util inputs files; sys = config; }; users = mapAttrs (_: value: {imports = value.homeConfig;}) settings; diff --git a/modules/user/security.nix b/modules/user/security.nix @@ -1,10 +1,11 @@ { config, lib, + util, files, ... }: let - inherit (lib) filterAttrs mkAfter mkForce mkIf util; + inherit (lib) filterAttrs mkAfter mkForce mkIf; inherit (builtins) all attrNames attrValues hasAttr mapAttrs readFile; inherit (config.sops) secrets; inherit (config.user) settings; diff --git a/packages/dotfiles.nix b/packages/dotfiles.nix @@ -6,7 +6,7 @@ }: pkgs.stdenv.mkDerivation rec { pname = "Dotfiles"; - version = "v13"; + version = "v15"; src = files.path.toplevel; dontBuild = true; diff --git a/packages/flake.nix b/packages/flake.nix @@ -0,0 +1,57 @@ +{ + util, + inputs, + ... +}: let + inherit (util) map; + inherit (builtins) attrValues; +in { + ## Package Configuration ## + perSystem = { + self', + system, + lib, + inputs', + pkgs, + ... + }: (let + # Package Calling Function + call = name: + pkgs.callPackage name { + inherit lib util inputs pkgs; + inherit (inputs.self) files; + }; + in rec { + # Default Package Channel + _module.args.pkgs = legacyPackages; + legacyPackages = with inputs; + import nixpkgs { + inherit system; + config = import ../modules/nix/config.nix; + overlays = + [nur.overlay] + ++ (attrValues self.overlays or {}) + ++ [ + (final: prev: { + custom = self.packages."${system}"; + wine = wine.packages."${system}"; + gaming = gaming.packages."${system}"; + generators = generators.packages."${system}".default; + }) + ]; + }; + + # Custom Packages + apps = + map.modules ../scripts (name: inputs.utils.lib.mkApp {drv = call name;}) + // {default = self'.apps.nixos;}; + packages = + map.modules ./. call + // map.modules ../scripts call + // {default = self'.packages.dotfiles;} + // inputs'.proprietary.packages; + }); + + # Package Overrides + flake.overlays = map.modules ./overlays import; +} diff --git a/packages/wine/7zip.nix b/packages/wine/7zip.nix @@ -1,13 +1,13 @@ { - system ? builtins.currentSystem, lib, + build, pkgs, wine, ... }: let inherit (builtins) concatLists map; inherit (pkgs) copyDesktopItems fetchurl makeDesktopItem; - inherit (lib.wine."${system}") copyDesktopIcons makeDesktopIcon mkWindowsApp; + inherit (build) copyDesktopIcons makeDesktopIcon mkWindowsApp; in mkWindowsApp rec { inherit wine; diff --git a/scripts/nixos.nix b/scripts/nixos.nix @@ -1,6 +1,7 @@ { system ? builtins.currentSystem, lib, + util, inputs, pkgs, files, @@ -9,7 +10,7 @@ with files; let inherit (inputs) self; inherit (util.map) array list; - inherit (lib) licenses recursiveUpdate util; + inherit (lib) licenses recursiveUpdate; devShells = list self.devShells."${system}"; installMedia = list self.installMedia; diff --git a/secrets/default.nix b/secrets/default.nix @@ -1,12 +1,11 @@ { lib, + util, inputs, pkgs, files, ... -}: let - inherit (lib) mkForce util; -in { +}: { imports = [inputs.sops.nixosModules.sops]; ## Authentication Credentials Management ## @@ -23,7 +22,7 @@ in { # GPG Key Import gnupg = { home = files.gpg; - sshKeyPaths = mkForce []; + sshKeyPaths = lib.mkForce []; }; }; }; diff --git a/shells/flake.nix b/shells/flake.nix @@ -0,0 +1,19 @@ +{util, ...}: let + inherit (util) map; +in { + ## Developer Shells ## + perSystem = { + self', + pkgs, + ... + }: { + devShells = + map.modules' ./. (file: pkgs.mkShell (import file pkgs)) + // { + default = import ./. {inherit pkgs;}; + website = import ../site/shell.nix {inherit pkgs;}; + commit = + pkgs.mkShell {inherit (self'.checks.commit) shellHook;}; + }; + }; +} diff --git a/users/default.nix b/users/default.nix @@ -1,10 +1,11 @@ { config, lib, + util, ... }: let inherit (builtins) attrValues map; - inherit (lib) id mkIf mkOption types util; + inherit (lib) id mkIf mkOption types; cfg = config.credentials.key; in { options.credentials = {