Compare commits

..

16 Commits

Author SHA1 Message Date
507b4fcefd added sops-nix 2026-11-14 17:04:25 +00:00
f08d778a56 added secrets 2026-11-14 16:44:58 +00:00
aa1807e17c added cursors 2026-11-14 16:31:48 +00:00
84ac992e26 added gtk theme 2026-11-14 16:28:04 +00:00
45a0c0ccf5 updated hyprland override syntax 2026-11-14 16:14:23 +00:00
362d9e744a added fira-mono to foot 2026-11-14 16:01:06 +00:00
f6f505cc03 updated readme to mention the hyprland config 2026-11-08 17:25:16 +00:00
3b039c93ac added comments for casual readers 2026-11-08 17:09:59 +00:00
ce5062db24 updated hyprland 2026-11-08 14:45:24 +00:00
a8a45d3b02 fixed hyprland scoping issue 2026-11-08 14:25:59 +00:00
f9e2b676a5 added foot feature 2026-11-08 14:25:52 +00:00
29469b9c13 updated hyprland 2026-11-08 14:15:15 +00:00
0dfc94e3d7 added hyprland feature 2026-11-08 14:13:22 +00:00
a36df6e6a9 reorganisation 2026-11-08 13:35:10 +00:00
aa20bae49c added comments for casual readers 2026-10-24 19:48:40 +01:00
d053a697bb added syntaxhighlighting option 2026-10-24 15:48:34 +01:00
25 changed files with 376 additions and 66 deletions

View File

@@ -17,5 +17,8 @@ Some commits will require impure evaluation, although I will keep this to a mini
Comments have been placed outside of filming to explain what parts of the code do, Comments have been placed outside of filming to explain what parts of the code do,
as this is a mostly "for reference" repo. as this is a mostly "for reference" repo.
This repo also depends on [this hyprland config](https://git.voidarc.co.uk/adumh00man/hyprland-dendritic),
which is self contained, but contains some more useful wrapper examples.
Any issues or typos or whatever can be reported via [email](mailto://admin@voidarc.co.uk) Any issues or typos or whatever can be reported via [email](mailto://admin@voidarc.co.uk)
or [matrix](https://matrix.to/#/@admin:voidarc.co.uk). Lots of love <3 or [matrix](https://matrix.to/#/@admin:voidarc.co.uk). Lots of love <3

3
age.txt Normal file
View File

@@ -0,0 +1,3 @@
# created: 2026-11-14T16:38:56Z
# public key: age1xxeh8ju80rcct7k349jx338ylav04a44cnmp924plxnhkjvhmfcqmas62n
AGE-SECRET-KEY-1WTP26ZUF85T79Q9VEQTP7U5L83M7QQHWFTUPXPPLY2YP6QYF8S2QCQ6XYU

45
flake.lock generated
View File

@@ -18,6 +18,29 @@
"type": "github" "type": "github"
} }
}, },
"hyprland": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"wrappers": [
"wrappers"
]
},
"locked": {
"lastModified": 1794672526,
"narHash": "sha256-r6vKRLhiij+fNQdDY2XhmYH+KtqXDWTGEjUR28FFQ1c=",
"ref": "refs/heads/main",
"rev": "24e78099cc14da3ee732719a6d5fdab150fa52c5",
"revCount": 7,
"type": "git",
"url": "https://git.voidarc.co.uk/adumh00man/hyprland-dendritic"
},
"original": {
"type": "git",
"url": "https://git.voidarc.co.uk/adumh00man/hyprland-dendritic"
}
},
"import-tree": { "import-tree": {
"locked": { "locked": {
"lastModified": 1788467110, "lastModified": 1788467110,
@@ -150,13 +173,35 @@
"root": { "root": {
"inputs": { "inputs": {
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"hyprland": "hyprland",
"import-tree": "import-tree", "import-tree": "import-tree",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable", "nixpkgs-unstable": "nixpkgs-unstable",
"nvim": "nvim", "nvim": "nvim",
"sops-nix": "sops-nix",
"wrappers": "wrappers_2" "wrappers": "wrappers_2"
} }
}, },
"sops-nix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1794624949,
"narHash": "sha256-3q/hxp/flW1PnV3Dx+H3p8kHGEHJ7251BqVMNsAAB9E=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "11e5885d241743ff0193465d533b20e754bc3ce0",
"type": "github"
},
"original": {
"owner": "Mic92",
"repo": "sops-nix",
"type": "github"
}
},
"wrappers": { "wrappers": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_3" "nixpkgs": "nixpkgs_3"

View File

@@ -15,6 +15,20 @@
# My Nvim config # My Nvim config
nvim.url = "git+https://git.voidarc.co.uk/voidarc/nvim"; nvim.url = "git+https://git.voidarc.co.uk/voidarc/nvim";
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# Hyprland Configuration
hyprland = {
url = "git+https://git.voidarc.co.uk/adumh00man/hyprland-dendritic";
inputs = {
nixpkgs.follows = "nixpkgs";
wrappers.follows = "wrappers";
};
};
# Nix Wrapper Modules # Nix Wrapper Modules
wrappers.url = "github:nix-community/nix-wrapper-modules"; wrappers.url = "github:nix-community/nix-wrapper-modules";
}; };

View File

@@ -0,0 +1,27 @@
{
moduleWithSystem,
self,
...
}: {
# Desktop Attribute, brings together all things you would need for a desktop
# Segmenting like this makes it easier to have different types of machines
# Using the same config, like having a "laptop" attribute if you need different
# packages there, etc.
flake.nixosModules.desktop = moduleWithSystem ({pkgs, ...}: let
modules = with self.nixosModules; [
core
networking
hyprland
theming
sops
];
in {
imports = modules;
# Add lazygit to every desktop
environment.systemPackages = with pkgs; [
lazygit
];
});
}

View File

@@ -0,0 +1,27 @@
{inputs, ...}: {
# PerSystem, gives access to self' and inputs', as well as some helper functions
perSystem = {pkgs, ...}: {
# Define packages as you would in a normal flake
packages = {
# Most basic package definition, gives #example output that runs pkgs.hello
# All packages are outputs, and all outputs can be built, run and cached, etc.
example = pkgs.hello;
# Universal wrapper, use this to quickly add flags to a program
bash = inputs.wrappers.lib.wrapPackage {
# Always inherit pkgs
inherit pkgs;
# Set package, could be anything
package = pkgs.bash;
# Flag set, once again can be anything
# Nix doesn't know what flags are valid, it will accept any two valid nix objects
# Data types are irrelevant, can be paths, ints, bools, etc.
flags = {
"--rcfile" = ./bashrc;
# to add the same flag twice, make the right hand side a set
# "--someflag" = {"firstTime", "secondTime"}
# You cannot repeat the left hand side
};
};
};
};
}

View File

@@ -1,14 +0,0 @@
{inputs, ...}: {
perSystem = {pkgs, ...}: {
packages = {
example = pkgs.hello;
bash = inputs.wrappers.lib.wrapPackage {
inherit pkgs;
package = pkgs.bash;
flags = {
"--rcfile" = ./bashrc;
};
};
};
};
}

View File

@@ -0,0 +1,28 @@
{
moduleWithSystem,
inputs,
...
}: {
flake.nixosModules.foot = moduleWithSystem ({self', ...}: {
environment.systemPackages = with self'.packages; [
foot
];
});
# PerSystem, gives access to self' and inputs', as well as some helper functions
perSystem = {pkgs, ...}: {
# Simple wrapper for foot, sets background color to bright red
packages.foot = let
fira-mono = pkgs.nerd-fonts.fira-mono;
font-config = pkgs.makeFontsConf {
fontDirectories = [fira-mono];
};
in
inputs.wrappers.wrappers.foot.wrap {
inherit pkgs;
env."FONTCONFIG_FILE" = "${font-config}";
settings = {
main.font = "FiraMono Nerd Font:size=18";
};
};
};
}

View File

@@ -0,0 +1,24 @@
{moduleWithSystem, ...}: {
# moduleWithSystem for Hyprland
flake.nixosModules.hyprland = moduleWithSystem ({self', ...}: {
# Native wrapper for hyprland instead of environment.systemPackages
programs.hyprland = {
enable = true;
package = self'.packages.hyprland;
};
});
perSystem = {
inputs',
pkgs,
self',
...
}: {
# Override input pacakge (using inputs' for right version)
packages.hyprland = inputs'.hyprland.packages.default.override {
# Change runtimePkgs to add custom foot version
runtimePkgs = {
foot = self'.packages.foot;
};
};
};
}

View File

@@ -0,0 +1,22 @@
{inputs, ...}: {
flake.nixosModules.sops = {
pkgs,
config,
...
}: {
imports = [inputs.sops-nix.nixosModules.default];
sops = {
age.keyFile = "/home/user01/Projects/dendritic-tutorial/age.txt";
defaultSopsFile = ./secrets.yaml;
secrets = {
secret = {};
something = {};
};
templates = {
"secret-value.env".content = "${config.sops.placeholder.something}";
};
};
};
}

View File

@@ -0,0 +1,17 @@
secret: ENC[AES256_GCM,data:2W9fC2QMVuctXc7kkX6a++ee,iv:igaTggUUKodYheKF4oxBwzfVjKJMAp/XNt+idd4xfek=,tag:Avv1hkngS7OAFAfMrbrD6A==,type:str]
something: ENC[AES256_GCM,data:rNfYkLtWVEgvU9Xrfg==,iv:v6q7846C+fWKz0gOo2xWcb0SGkha+dJMTZ2/4+uud10=,tag:FZhiU7NuReIk4BLlnquMhA==,type:str]
sops:
age:
- enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBUa0orV3o0Qm82MUo3NlNG
YitrcGNUUWZQUkszc096VlI5SWxrTkxNdVZRCjZLelZaV1p2MzNDRjVNS3lNMnVw
SWl5NkVHSWNrOHVaa3YySWVzZVhNcFEKLS0tIEdVU0RYY2ZDcUorK0cvT1lYTjhw
ekE0QjBkSnVWYWE1LzN1VHphZWtWMHcKc83T1EyVzmQHtGA2Mdt4uRsYx89AbNkg
Ng3b82VcxZQzR9HadM55MFy2BKGqpjOed+iBwesliU2JPcbkQb75dg==
-----END AGE ENCRYPTED FILE-----
recipient: age1xxeh8ju80rcct7k349jx338ylav04a44cnmp924plxnhkjvhmfcqmas62n
lastmodified: "2026-11-14T16:43:47Z"
mac: ENC[AES256_GCM,data:+RcPJKJrejXkEw17qmYDFSb62Cc4QxsQdZ1j7UkMaPenoebzgQl6kQIbPAlK14rDldmRnSGm0A3YOrB8Y6S0URu+H4R2e+PdXEo4xJKnIHfWufCmJj+k++d8Sueh3030JJuDJvjKGm6/l4/CkUDXELnVQGKlaF3Rux31ORHDvtI=,iv:1gEnVSC8r10qEMUATcoukvd0GuqxIYtXlJi+yirAl5k=,tag:Q3sOasF4i9wEySR02L4U1g==,type:str]
unencrypted_suffix: _unencrypted
version: 3.13.3

View File

@@ -1,38 +1,89 @@
{ {
inputs, inputs,
# moduleWithSystem allows for using self' in modules
moduleWithSystem, moduleWithSystem,
... ...
}: { }: {
# enclose moduleWithSystem expression in (), so the final expression is one object
flake.nixosModules.zsh = moduleWithSystem ({ flake.nixosModules.zsh = moduleWithSystem ({
pkgs, pkgs,
self', # Self' allows accessing packages without having to point to the os string
... self',
}: { ...
nixpkgs.overlays = [ }:
(final: prev: { # This is a "double expression", being written like {...}: {...}: {};
zsh = self'.packages.zsh; # having an extra {...}. This is because the first attribute set only contains
}) # flake parts attributes (self', flake.nixosModules, etc), and not nixos attributes.
]; # The usual nixos attributes, like config, are passed into a potential second attribute
# set, allowing you to access them there. This set is not implicit, and must be defined.
programs.zsh = { # This means that the code can be read as:
enable = true; # {flake-parts attrs}: {nix attrs}: {actual expression};
}; {config, ...}:
}); # A let in statement allows setting of variables, in this case pointing any reference
# of "lib" to "pkgs.lib". These can be stacked, and can be thought of as a way of
# scoping variables.
let
lib = pkgs.lib;
in {
# When the config or options objects are defined, nothing else can be in the expression.
# Options contains a list of defined options, and config becomes the wrapper for everything
# else in the expression. Imports works as expected.
imports = [];
options = {
# Make a new option with lib.mkOption
enableHighlighting = lib.mkOption {
# Set type, eg bool, str, int. Custom types can be created
type = lib.types.bool;
# Default value is required
default = false;
# Description is optional but useful
description = "Enable syntax highlighting";
};
};
config = {
# Nixpkgs overlay, replacing the universal "pkgs.zsh" with "self'.packages.zsh".
# As stated, self' allows you to shorten the package definition from
# self.${pkgs.stdenv.hostPlatform.system}.packages.zsh;
# into just self'.packages.zsh, meaning package platform errors are almost impossible.
nixpkgs.overlays = [
(final: prev: {
zsh = self'.packages.zsh;
})
];
programs.zsh = {
enable = true;
# You can use config options through the config attribute, in place of a normal value,
# the same way you can in other programming languages.
enableSyntaxHighlighting = config.enableHighlighting;
};
};
});
# PerSystem should be defined in the same scope as flake.nixosModules
perSystem = { perSystem = {
# Inherited from inputs.nixpkgs
pkgs, pkgs,
# Custom arg, see modules/system/nix-settings.nix
unstablePkgs, unstablePkgs,
# Same principle of self', removes need for direct reference to os-string
inputs', inputs',
# Helper, points to pkgs.lib
lib, lib,
... ...
}: { }: {
# Defined wrapper for zsh, docs are on nix-wrapper modules site
packages.zsh = inputs.wrappers.wrappers.zsh.wrap { packages.zsh = inputs.wrappers.wrappers.zsh.wrap {
# Pkgs MUST be defined, always inherit pkgs in a wrapper
inherit pkgs; inherit pkgs;
zshAliases = { zshAliases = {
# By making an alias reference a package, zsh becomes dependant on that package.
# This idea allows for fully portable modules with implicit dependancy trees
some = lib.getExe unstablePkgs.vim; some = lib.getExe unstablePkgs.vim;
v = lib.getExe inputs'.nvim.packages.default; v = lib.getExe inputs'.nvim.packages.default;
ff = lib.getExe pkgs.fastfetch; ff = lib.getExe pkgs.fastfetch;
cat = lib.getExe pkgs.bat; cat = lib.getExe pkgs.bat;
secret = "cat /run/secrets/secret-value";
}; };
# Can also be zshrc.path, and path will take precedence over content.
zshrc.content = '' zshrc.content = ''
export SOME=some export SOME=some
''; '';

View File

@@ -9,7 +9,7 @@
# Define modules to import # Define modules to import
modules = with self.nixosModules; [ modules = with self.nixosModules; [
hostConfiguration hostConfiguration
system desktop
]; ];
}; };
} }

View File

@@ -9,8 +9,16 @@
# Define modules to import # Define modules to import
modules = with self.nixosModules; [ modules = with self.nixosModules; [
newHostConfiguration newHostConfiguration
system desktop
zsh zsh
# Change config options in this object
# This can be done per-host with different options,
# allowing for smaller changes to modules' functionality
# Without having to create a whole new module
({...}: {
enableHighlighting = true;
})
]; ];
}; };
} }

View File

@@ -0,0 +1,25 @@
{self, ...}: {
# This module acts as a collection of other modules, for ease
# of use. Adding another module to this list will import it
# for all other modules that import this one.
# Keep in mind that you cannot import this module alongside
# any of its children. For example, importing this module and
# the user module in the same block is the same as importing
# the user module twice, leading to an error due to trying
# to define the same user twice.
# Collections should be used for static lists of modules, like
# those that would make up a basic system, as seen here.
# Define flake part nixosModule "core"
flake.nixosModules.core = {...}: let
modules = with self.nixosModules; [
user
bootloader
imports
];
in {
imports = modules;
};
}

View File

@@ -0,0 +1,23 @@
{inputs, ...}: {
# PerSystem, allows for universal module access
perSystem = {system, ...}: {
# Pre-defined object
_module.args = {
# Custom object, creating a new nixpkgs from a different input
unstablePkgs = import inputs.nixpkgs-unstable {
inherit system;
};
# Another example not in the video, creating an unfree instance of nixpkgs
# Setting nixpkgs.config.free = true isn't possible through a normal nixosModule,
# because of how inheritance works with nixos exclusive objects
unfreePkgs = import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
};
# You can also set universal variables here, if you need to access the same info across files
someVariable = "import this as you would import pkgs, in a perSystem block";
};
};
}

View File

@@ -1,26 +0,0 @@
{self, ...}: {
# This module acts as a collection of other modules, for ease
# of use. Adding another module to this list will import it
# for all other modules that import this one.
# Keep in mind that you cannot import this module alongside
# any of its children. For example, importing this module and
# the user module in the same block is the same as importing
# the user module twice, leading to an error due to trying
# to define the same user twice.
# Collections should be used for static lists of modules, like
# those that would make up a basic system, as seen here.
# Define flake part nixosModule "system"
flake.nixosModules.system = {...}: let
modules = with self.nixosModules; [
user
networking
bootloader
imports
];
in {
imports = modules;
};
}

View File

@@ -1,9 +0,0 @@
{inputs, ...}: {
perSystem = {system, ...}: {
_module.args = {
unstablePkgs = import inputs.nixpkgs-unstable {
inherit system;
};
};
};
}

View File

@@ -0,0 +1,42 @@
{moduleWithSystem, ...}: {
flake.nixosModules.theming = moduleWithSystem ({pkgs, ...}: {
environment.systemPackages = with pkgs; [
(catppuccin-gtk.override {
accents = ["mauve"];
size = "compact";
tweaks = ["rimless"];
variant = "mocha";
})
(catppuccin-papirus-folders.override {
accent = "mauve";
})
bibata-cursors
nwg-look
];
environment.variables = {
XCURSOR_THEME = "Bibata-Modern-Ice";
XCURSOR_SIZE = "20";
};
programs = {
xfconf.enable = true;
dconf = {
enable = true;
profiles.user.databases = [
{
lockAll = false;
settings = {
"org/gnome/desktop/interface" = {
gtk-theme = "catppuccin-mocha-mauve-compact+rimless";
icon-theme = "Papirus";
color-scheme = "prefer-dark";
cursor-name = "Bibata-Modern-Ice";
};
};
}
];
};
};
});
}