Moved modules and hm dir to hosts dir. Moved some code to shared and extended lib with custom functions

This commit is contained in:
Martin Berg Alstad 2025-04-12 17:05:38 +02:00
parent df5bea9cc0
commit e3a1dd36d7
Signed by: martials
GPG Key ID: 706F53DD087A91DE
99 changed files with 550 additions and 140 deletions

2
.gitattributes vendored
View File

@ -1 +1 @@
home-manager/secrets/* filter=git-crypt diff=git-crypt shared/secrets/* filter=git-crypt diff=git-crypt

350
flake.lock generated
View File

@ -3,7 +3,10 @@
"ags": { "ags": {
"inputs": { "inputs": {
"astal": "astal", "astal": "astal",
"nixpkgs": ["hyprpanel", "nixpkgs"] "nixpkgs": [
"hyprpanel",
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1736090999, "lastModified": 1736090999,
@ -21,7 +24,11 @@
}, },
"astal": { "astal": {
"inputs": { "inputs": {
"nixpkgs": ["hyprpanel", "ags", "nixpkgs"] "nixpkgs": [
"hyprpanel",
"ags",
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1735172721, "lastModified": 1735172721,
@ -42,11 +49,11 @@
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1743414153, "lastModified": 1744447794,
"narHash": "sha256-bFIXz7SvLlSNR4M3vYPYS1CpEN9vTUiH01R4iR/BDmA=", "narHash": "sha256-z5uK5BDmFg0L/0EW2XYLGr39FbQeXyNVnIEhkZrG8+Q=",
"owner": "catppuccin", "owner": "catppuccin",
"repo": "nix", "repo": "nix",
"rev": "2f52f9ead26f80d7b391cedcbb3eb309bd83fff4", "rev": "c44fe73ed8e5d5809eded7cc6156ca9c40044e42",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -55,9 +62,47 @@
"type": "github" "type": "github"
} }
}, },
"devshell": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1741473158,
"narHash": "sha256-kWNaq6wQUbUMlPgw8Y+9/9wP0F8SHkjy24/mN3UAppg=",
"owner": "numtide",
"repo": "devshell",
"rev": "7c9e793ebe66bcba8292989a68c0419b737a22a0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"flake-compat": {
"locked": {
"lastModified": 1733328505,
"narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
"revCount": 69,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.1.0/01948eb7-9cba-704f-bbf3-3fa956735b52/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
}
},
"flake-parts": { "flake-parts": {
"inputs": { "inputs": {
"nixpkgs-lib": ["nixvim", "nixpkgs"] "nixpkgs-lib": [
"nixvim",
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1743550720, "lastModified": 1743550720,
@ -91,16 +136,64 @@
"type": "github" "type": "github"
} }
}, },
"git-hooks": {
"inputs": {
"flake-compat": [
"nixvim",
"flake-compat"
],
"gitignore": "gitignore",
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1742649964,
"narHash": "sha256-DwOTp7nvfi8mRfuL1escHDXabVXFGT1VlPD1JHrtrco=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"nixvim",
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"grayjay": { "grayjay": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_2" "nixpkgs": "nixpkgs_2"
}, },
"locked": { "locked": {
"lastModified": 1743563044, "lastModified": 1744375210,
"narHash": "sha256-UkykPaJt9Yr8YbBg34Bnh4wE+J2sksSDFdaalfnkG6k=", "narHash": "sha256-aMnp0e+oGmsZ+VC6mgrE6lUcKMjBPotLesCosejRhdw=",
"owner": "rishabh5321", "owner": "rishabh5321",
"repo": "grayjay-flake", "repo": "grayjay-flake",
"rev": "82a651064b00480042d1b7f180ca77e04ea08689", "rev": "ab754473aecde1afad07ab5a5903c9336bcb5442",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -111,14 +204,16 @@
}, },
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": ["nixpkgs"] "nixpkgs": [
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1743387206, "lastModified": 1744117652,
"narHash": "sha256-24N3NAuZZbYqZ39NgToZgHUw6M7xHrtrAm18kv0+2Wo=", "narHash": "sha256-t7dFCDl4vIOOUMhEZnJF15aAzkpaup9x4ZRGToDFYWI=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "15c5f9d04fabd176f30286c8f52bbdb2c853a146", "rev": "b4e98224ad1336751a2ac7493967a4c9f6d9cb3f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -128,17 +223,60 @@
"type": "github" "type": "github"
} }
}, },
"home-manager_2": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1743808813,
"narHash": "sha256-2lDQBOmlz9ggPxcS7/GvcVdzXMIiT+PpMao6FbLJSr0=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "a9f8b3db211b4609ddd83683f9db89796c7f6ac6",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-24.11",
"repo": "home-manager",
"type": "github"
}
},
"home-manager_3": {
"inputs": {
"nixpkgs": [
"zen-browser",
"nixpkgs"
]
},
"locked": {
"lastModified": 1743604125,
"narHash": "sha256-ZD61DNbsBt1mQbinAaaEqKaJk2RFo9R/j+eYWeGMx7A=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "180fd43eea296e62ae68e079fcf56aba268b9a1a",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"hyprpanel": { "hyprpanel": {
"inputs": { "inputs": {
"ags": "ags", "ags": "ags",
"nixpkgs": "nixpkgs_3" "nixpkgs": "nixpkgs_3"
}, },
"locked": { "locked": {
"lastModified": 1740863579, "lastModified": 1744259355,
"narHash": "sha256-U4amsszfgPUTAa9FrIlYsCCpmAyko22h/nbjhmAZvAs=", "narHash": "sha256-gykRJw309t5NLuYXzWw9WhJFKTc4OASmc16M9jD/Vpw=",
"owner": "Jas-SinghFSU", "owner": "Jas-SinghFSU",
"repo": "HyprPanel", "repo": "HyprPanel",
"rev": "2be9f1ef6c2df2ecf0eebe5a039e8029d8d151cd", "rev": "1d4d2dcc20ebd707d5e45c7e357acc1267a498d7",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -149,8 +287,16 @@
}, },
"ixx": { "ixx": {
"inputs": { "inputs": {
"flake-utils": ["nixvim", "nuschtosSearch", "flake-utils"], "flake-utils": [
"nixpkgs": ["nixvim", "nuschtosSearch", "nixpkgs"] "nixvim",
"nuschtosSearch",
"flake-utils"
],
"nixpkgs": [
"nixvim",
"nuschtosSearch",
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1729958008, "lastModified": 1729958008,
@ -167,13 +313,35 @@
"type": "github" "type": "github"
} }
}, },
"nix-darwin": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1743127615,
"narHash": "sha256-+sMGqywrSr50BGMLMeY789mSrzjkoxZiu61eWjYS/8o=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "fc843893cecc1838a59713ee3e50e9e7edc6207c",
"type": "github"
},
"original": {
"owner": "lnl7",
"ref": "nix-darwin-24.11",
"repo": "nix-darwin",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1742889210, "lastModified": 1744098102,
"narHash": "sha256-hw63HnwnqU3ZQfsMclLhMvOezpM7RSB0dMAtD5/sOiw=", "narHash": "sha256-tzCdyIJj9AjysC3OuKA+tMD/kDEDAF9mICPDU7ix0JA=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "698214a32beb4f4c8e3942372c694f40848b360d", "rev": "c8cd81426f45942bb2906d5ed2fe21d2f19d95b7",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -183,17 +351,33 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-unstable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1743448293, "lastModified": 1744309437,
"narHash": "sha256-bmEPmSjJakAp/JojZRrUvNcDX2R5/nuX6bm+seVaGhs=", "narHash": "sha256-QZnNHM823am8apCqKSPdtnzPGTy2ZB4zIXOVoBp5+W0=",
"owner": "nixos", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "77b584d61ff80b4cef9245829a6f1dfad5afdfa3", "rev": "f9ebe33a928b5d529c895202263a5ce46bdf12f7",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nixos", "owner": "NixOS",
"ref": "nixos-24.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1744232761,
"narHash": "sha256-gbl9hE39nQRpZaLjhWKmEu5ejtQsgI5TWYrIVVJn30U=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f675531bc7e6657c10a18b565cfebd8aa9e24c14",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
@ -201,11 +385,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1743448293, "lastModified": 1744232761,
"narHash": "sha256-bmEPmSjJakAp/JojZRrUvNcDX2R5/nuX6bm+seVaGhs=", "narHash": "sha256-gbl9hE39nQRpZaLjhWKmEu5ejtQsgI5TWYrIVVJn30U=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "77b584d61ff80b4cef9245829a6f1dfad5afdfa3", "rev": "f675531bc7e6657c10a18b565cfebd8aa9e24c14",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -233,15 +417,15 @@
}, },
"nixpkgs_4": { "nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1743501102, "lastModified": 1744309437,
"narHash": "sha256-7PCBQ4aGVF8OrzMkzqtYSKyoQuU2jtpPi4lmABpe5X4=", "narHash": "sha256-QZnNHM823am8apCqKSPdtnzPGTy2ZB4zIXOVoBp5+W0=",
"owner": "nixos", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "02f2af8c8a8c3b2c05028936a1e84daefa1171d4", "rev": "f9ebe33a928b5d529c895202263a5ce46bdf12f7",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nixos", "owner": "NixOS",
"ref": "nixos-24.11", "ref": "nixos-24.11",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
@ -249,11 +433,11 @@
}, },
"nixpkgs_5": { "nixpkgs_5": {
"locked": { "locked": {
"lastModified": 1742288794, "lastModified": 1743448293,
"narHash": "sha256-Txwa5uO+qpQXrNG4eumPSD+hHzzYi/CdaM80M9XRLCo=", "narHash": "sha256-bmEPmSjJakAp/JojZRrUvNcDX2R5/nuX6bm+seVaGhs=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "b6eaf97c6960d97350c584de1b6dcff03c9daf42", "rev": "77b584d61ff80b4cef9245829a6f1dfad5afdfa3",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -265,20 +449,29 @@
}, },
"nixvim": { "nixvim": {
"inputs": { "inputs": {
"devshell": "devshell",
"flake-compat": "flake-compat",
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"nixpkgs": ["nixpkgs-unstable"], "git-hooks": "git-hooks",
"nuschtosSearch": "nuschtosSearch" "home-manager": "home-manager_2",
"nix-darwin": "nix-darwin",
"nixpkgs": [
"nixpkgs"
],
"nuschtosSearch": "nuschtosSearch",
"treefmt-nix": "treefmt-nix"
}, },
"locked": { "locked": {
"lastModified": 1743598191, "lastModified": 1743856924,
"narHash": "sha256-30aI8rWjX64E9vIlE4iqgQguTjItvTnQLTqHtFppF/w=", "narHash": "sha256-CgCbUGd9y639PfcuzA0TrA6O5N1ICl+mB95+qTG52+E=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixvim", "repo": "nixvim",
"rev": "a183298bf67307bdb7a25a2a3c565e76029f1b9e", "rev": "d209a04d349febe85c777078ca2eeea5e8bbc8a1",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "nix-community",
"ref": "nixos-24.11",
"repo": "nixvim", "repo": "nixvim",
"type": "github" "type": "github"
} }
@ -287,14 +480,17 @@
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"ixx": "ixx", "ixx": "ixx",
"nixpkgs": ["nixvim", "nixpkgs"] "nixpkgs": [
"nixvim",
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1743201766, "lastModified": 1743683223,
"narHash": "sha256-bb/dqoIjtIWtJRzASOe8g4m8W2jUIWtuoGPXdNjM/Tk=", "narHash": "sha256-LdXtHFvhEC3S64dphap1pkkzwjErbW65eH1VRerCUT0=",
"owner": "NuschtOS", "owner": "NuschtOS",
"repo": "search", "repo": "search",
"rev": "2651dbfad93d6ef66c440cbbf23238938b187bde", "rev": "56a49ffef2908dad1e9a8adef1f18802bc760962",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -310,23 +506,47 @@
"home-manager": "home-manager", "home-manager": "home-manager",
"hyprpanel": "hyprpanel", "hyprpanel": "hyprpanel",
"nixpkgs": "nixpkgs_4", "nixpkgs": "nixpkgs_4",
"nixpkgs-stable": "nixpkgs-stable",
"nixpkgs-unstable": "nixpkgs-unstable", "nixpkgs-unstable": "nixpkgs-unstable",
"nixvim": "nixvim", "nixvim": "nixvim",
"sops-nix": "sops-nix",
"spicetify-nix": "spicetify-nix", "spicetify-nix": "spicetify-nix",
"zen-browser": "zen-browser" "zen-browser": "zen-browser"
} }
}, },
"sops-nix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1744103455,
"narHash": "sha256-SR6+qjkPjGQG+8eM4dCcVtss8r9bre/LAxFMPJpaZeU=",
"owner": "mic92",
"repo": "sops-nix",
"rev": "69d5a5a4635c27dae5a742f36108beccc506c1ba",
"type": "github"
},
"original": {
"owner": "mic92",
"repo": "sops-nix",
"type": "github"
}
},
"spicetify-nix": { "spicetify-nix": {
"inputs": { "inputs": {
"nixpkgs": ["nixpkgs"], "nixpkgs": [
"nixpkgs-unstable"
],
"systems": "systems_2" "systems": "systems_2"
}, },
"locked": { "locked": {
"lastModified": 1743595372, "lastModified": 1744423915,
"narHash": "sha256-e3x1mhpPpYgyyin9j/VbrBpOT5PFpEfx2hkxVZuJZhg=", "narHash": "sha256-6Hd8VyrOlmjlDBgPpx9NwX4+/uO4gEDIyjqbQLyniwE=",
"owner": "Gerg-L", "owner": "Gerg-L",
"repo": "spicetify-nix", "repo": "spicetify-nix",
"rev": "543f12dd14c62ddee79ab79fbfd8726f312b89ff", "rev": "4c4b9611c71d586ea818fa5b8dcbd81129f62560",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -365,16 +585,38 @@
"type": "github" "type": "github"
} }
}, },
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1743748085,
"narHash": "sha256-uhjnlaVTWo5iD3LXics1rp9gaKgDRQj6660+gbUU3cE=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "815e4121d6a5d504c0f96e5be2dd7f871e4fd99d",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"zen-browser": { "zen-browser": {
"inputs": { "inputs": {
"home-manager": "home-manager_3",
"nixpkgs": "nixpkgs_5" "nixpkgs": "nixpkgs_5"
}, },
"locked": { "locked": {
"lastModified": 1743600524, "lastModified": 1744406237,
"narHash": "sha256-ZJesdL2jwCwBF4SsWvxNyGuHUv8cGLHIQwJxma6JQR0=", "narHash": "sha256-Xbt5m3/ZNeye4b42rCZOLbD8OhCOeJfUSEJ+FvfXwpg=",
"owner": "0xc000022070", "owner": "0xc000022070",
"repo": "zen-browser-flake", "repo": "zen-browser-flake",
"rev": "9818e303273448dde6ada0f7bff8b98f5ce261da", "rev": "4d9ee0daab52a7a205e69cfddcd441ffaa09c802",
"type": "github" "type": "github"
}, },
"original": { "original": {

149
flake.nix
View File

@ -1,75 +1,108 @@
{ {
description = "NixOS configuration"; description = "Martin's NixOS configuration - Based on EmergentMind/nix-config";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; #
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; # ========= Official NixOS and HM Package Sources =========
#
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
# The next two are for pinning to stable vs unstable regardless of what the above is set to
# This is particularly useful when an upcoming stable release is in beta because you can effectively
# keep 'nixpkgs-stable' set to stable for critical packages while setting 'nixpkgs' to the beta branch to
# get a jump start on deprecation changes.
# See also 'stable-packages' and 'unstable-packages' overlays at 'overlays/default.nix"
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.11";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
catppuccin = {
url = "github:catppuccin/nix";
};
home-manager = { home-manager = {
url = "github:nix-community/home-manager/release-24.11"; url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
#
# ========= Utilities =========
#
# Secrets management
sops-nix = {
url = "github:mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# Catppuccin theming
catppuccin = {
url = "github:catppuccin/nix";
};
# vim
nixvim = {
url = "github:nix-community/nixvim/nixos-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
# Bar
hyprpanel = { hyprpanel = {
url = "github:Jas-SinghFSU/HyprPanel"; url = "github:Jas-SinghFSU/HyprPanel";
}; };
nixvim = { # Spotify
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
spicetify-nix = { spicetify-nix = {
url = "github:Gerg-L/spicetify-nix"; url = "github:Gerg-L/spicetify-nix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs-unstable";
}; };
# Browser
zen-browser.url = "github:0xc000022070/zen-browser-flake"; zen-browser.url = "github:0xc000022070/zen-browser-flake";
# Video aggregator
grayjay.url = "github:rishabh5321/grayjay-flake"; grayjay.url = "github:rishabh5321/grayjay-flake";
}; };
outputs = outputs =
inputs@{ {
self, # Get a ref to outputs self,
nixpkgs, nixpkgs,
nixpkgs-unstable,
home-manager, home-manager,
... ...
}: }@inputs:
let let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
inherit (self) outputs; inherit (self) outputs;
common = import ./common.nix; common = import ./shared/common.nix;
theme = import ./theme.nix; theme = import ./shared/theme.nix;
#
# ========= Architectures =========
#
forAllSystems = nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
];
# ========== Extend lib with lib.custom ==========
# NOTE: This approach allows lib.custom to propagate into hm
# see: https://github.com/nix-community/home-manager/pull/3454
customLib = (_self: _super: { custom = import ./lib { inherit (nixpkgs) lib; }; });
lib = nixpkgs.lib.extend customLib;
libHm = home-manager.lib.extend customLib;
in in
{ {
defaultPackage.${system} = home-manager.defaultPackage.${system}; #
# ========= Overlays =========
#
# Custom modifications/overrides to upstream packages
overlays = import ./overlays.nix { inherit inputs; };
# The minimum amount of dependencies in order to run 'just switch-now' #
devShells.${system}.default = pkgs.mkShell { # ========= Host Configurations =========
packages = with pkgs; [ #
just nixosConfigurations.desktop = nixpkgs.lib.nixosSystem {
git system = "x86_64-linux";
git-crypt
nh
];
};
# Adds the nix fmt command to format nix files
formatter.${system} = pkgs.nixfmt-rfc-style;
nixosConfigurations.${common.hostname} = nixpkgs.lib.nixosSystem {
system = system;
specialArgs = { specialArgs = {
inherit inherit
outputs outputs
inputs inputs
common common
theme theme
lib
; ;
}; # Pass args to modules isDarwin = false;
};
modules = [ modules = [
./configuration.nix ./hosts/desktop
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ {
home-manager = { home-manager = {
@ -78,22 +111,40 @@
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
# Passes inputs as an argument to home-manager # Passes inputs as an argument to home-manager
extraSpecialArgs = { inherit inputs common theme; }; extraSpecialArgs = {
users.${common.username} = import ./home-manager; inherit
inputs
common
theme
libHm
;
};
users.${common.username} = import ./hosts/desktop/home-manager;
}; };
} }
./overlays.nix {
nixpkgs.overlays = with inputs; [
hyprpanel.overlay
];
}
]; ];
}; };
overlays = { #
# Gives access to unstable packages everywhere # ========= Formatting =========
unstable-packages = final: _prev: { #
unstable = import nixpkgs-unstable { # Nix formatter available through 'nix fmt' https://github.com/NixOS/nixfmt
system = final.system; formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style);
config.allowUnfree = true;
}; #
}; # ========= DevShell =========
}; #
# Custom shell for bootstrapping on new hosts, modifying nix-config, and secrets management
devShells = forAllSystems (
system:
import ./shell.nix {
pkgs = nixpkgs.legacyPackages.${system};
}
);
}; };
} }

74
hosts/desktop/flake.nix Normal file
View File

@ -0,0 +1,74 @@
{
description = "NixOS configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs@{
self,
nixpkgs,
nixpkgs-unstable,
home-manager,
...
}:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
inherit (self) outputs;
common = import ./common.nix;
theme = import ../shared/theme.nix;
in
{
defaultPackage.${system} = home-manager.defaultPackage.${system};
# Adds the nix fmt command to format nix files
formatter.${system} = pkgs.nixfmt-rfc-style;
nixosConfigurations.${common.hostname} = nixpkgs.lib.nixosSystem {
system = system;
specialArgs = {
inherit
outputs
inputs
common
theme
;
}; # Pass args to modules
modules = [
./configuration.nix
home-manager.nixosModules.home-manager
{
home-manager = {
# Backups conflicting files in case of error
backupFileExtension = "bkp";
useGlobalPkgs = true;
useUserPackages = true;
# Passes inputs as an argument to home-manager
extraSpecialArgs = { inherit inputs common theme; };
users.${common.username} = import ./home-manager;
};
}
./overlays.nix
];
};
overlays = {
# Gives access to unstable packages everywhere
unstable-packages = final: _prev: {
unstable = import nixpkgs-unstable {
system = final.system;
config.allowUnfree = true;
};
};
};
};
}

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -1,5 +1,6 @@
{ {
inputs, inputs,
outputs,
common, common,
... ...
}: }:
@ -45,6 +46,9 @@ in
stateVersion = common.system.version; stateVersion = common.system.version;
}; };
# Adds pkgs.unstable in order to fetch packages from unstable repositories
nixpkgs.overlays = [ outputs.overlays.unstable-packages ];
# Let Home Manager install and manage itself. # Let Home Manager install and manage itself.
programs.home-manager.enable = true; programs.home-manager.enable = true;
} }

View File

@ -1,3 +1,5 @@
{ lib, ... }:
{ {
programs = { programs = {
fish.shellAliases.fetch = "fastfetch"; fish.shellAliases.fetch = "fastfetch";
@ -6,7 +8,7 @@
enable = true; enable = true;
settings = { settings = {
logo = { logo = {
source = "${../Catppuccin.png}"; source = "${lib.custom.relativeToRoot "shared/assets/Catppuccin.png"}";
type = "kitty"; type = "kitty";
height = 18; height = 18;
padding.top = 2; padding.top = 2;

View File

@ -1,6 +1,4 @@
# Home configurations for Hyprland. For system configs, see ./modules/hyprland # Home configurations for Hyprland. For system configs, see ./modules/hyprland
{ outputs, ... }:
{ {
imports = [ imports = [
./binds.nix ./binds.nix
@ -14,9 +12,6 @@
./swaync ./swaync
]; ];
# Adds pkgs.unstable in order to fetch packages from unstable repositories
nixpkgs.overlays = [ outputs.overlays.unstable-packages ];
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
systemd.variables = [ "--all" ]; # Import environment into systemd systemd.variables = [ "--all" ]; # Import environment into systemd

View File

@ -17,9 +17,6 @@
# Fix the overwrite issue with HyprPanel. # Fix the overwrite issue with HyprPanel.
overwrite.enable = true; overwrite.enable = true;
# Import a theme from './themes/*.json'.
theme = "";
# Override the final config with an arbitrary set. # Override the final config with an arbitrary set.
# Useful for overriding colors in your selected theme. # Useful for overriding colors in your selected theme.
# Default: {} # Default: {}
@ -27,6 +24,27 @@
theme.bar.menus.text = "#123ABC"; theme.bar.menus.text = "#123ABC";
}; };
# Configure and theme almost all options from the GUI.
# Options that require '{}' or '[]' are not yet implemented,
# except for the layout above.
# See 'https://hyprpanel.com/configuration/settings.html'.
# Default: <same as gui>
settings = {
bar = {
clock.format = "%a %b %d %H:%M";
customModules.kbLayout.leftClick = "hyprctl switchxkblayout keychron-keychron-k8-pro next";
launcher.autoDetectIcon = true;
network.label = false;
volume = {
scrollDown = "${pkgs.hyprpanel}/bin/hyprpanel 'vol -1'";
scrollUp = "${pkgs.hyprpanel}/bin/hyprpanel 'vol +1'";
};
workspaces = {
show_icons = false;
show_numbered = true;
};
};
# Configure bar layouts for monitors. # Configure bar layouts for monitors.
layout = { layout = {
"bar.layouts" = { "bar.layouts" = {
@ -49,27 +67,6 @@
}; };
}; };
# Configure and theme almost all options from the GUI.
# Options that require '{}' or '[]' are not yet implemented,
# except for the layout above.
# See 'https://hyprpanel.com/configuration/settings.html'.
# Default: <same as gui>
settings = {
bar = {
clock.format = "%a %b %d %H:%M";
customModules.kbLayout.leftClick = "hyprctl switchxkblayout keychron-keychron-k8-pro next";
launcher.autoDetectIcon = true;
network.label = false;
volume = {
scrollDown = "${pkgs.hyprpanel}/bin/hyprpanel 'vol -1'";
scrollUp = "${pkgs.hyprpanel}/bin/hyprpanel 'vol +1'";
};
workspaces = {
show_icons = false;
show_numbered = true;
};
};
menus = { menus = {
clock = { clock = {
time = { time = {

View File

Before

Width:  |  Height:  |  Size: 969 B

After

Width:  |  Height:  |  Size: 969 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 877 B

After

Width:  |  Height:  |  Size: 877 B

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 568 B

After

Width:  |  Height:  |  Size: 568 B

View File

@ -0,0 +1,7 @@
{ inputs, ... }:
{
nixpkgs.overlays = with inputs; [
hyprpanel.overlay
];
}

21
lib/default.nix Normal file
View File

@ -0,0 +1,21 @@
# FIXME(lib.custom): Add some stuff from hmajid2301/dotfiles/lib/module/default.nix, as simplifies option declaration
{ lib, ... }:
{
# use path relative to the root of the project
relativeToRoot = lib.path.append ../.;
scanPaths =
path:
builtins.map (f: (path + "/${f}")) (
builtins.attrNames (
lib.attrsets.filterAttrs (
path: _type:
(_type == "directory") # include directories
|| (
(path != "default.nix") # ignore default.nix
&& (lib.strings.hasSuffix ".nix" path) # include .nix files
)
) (builtins.readDir path)
)
);
}

View File

@ -1,7 +1,11 @@
{ inputs, ... }: { inputs, ... }:
{ {
nixpkgs.overlays = with inputs; [ # Gives access to unstable packages everywhere
hyprpanel.overlay unstable-packages = final: _prev: {
]; unstable = import inputs.nixpkgs-unstable {
system = final.system;
config.allowUnfree = true;
};
};
} }

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

Before

Width:  |  Height:  |  Size: 808 KiB

After

Width:  |  Height:  |  Size: 808 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 2.1 MiB

View File

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

Before

Width:  |  Height:  |  Size: 282 KiB

After

Width:  |  Height:  |  Size: 282 KiB

View File

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 102 KiB

View File

@ -13,7 +13,7 @@ rec {
pictures = "${dir.home}/Pictures"; pictures = "${dir.home}/Pictures";
}; };
hostname = "nixos"; hostname = "desktop";
keymaps = { keymaps = {
layout = "gb,no"; layout = "gb,no";
@ -34,7 +34,7 @@ rec {
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.version = "24.11"; system.version = "24.11";
secret.weatherApiKey = lib: loadSecret lib ./home-manager/secrets/weather-api-key; secret.weatherApiKey = lib: loadSecret lib ./secrets/weather-api-key;
loadSecret = loadSecret =
lib: filePath: lib.strings.trim (lib.strings.removeSuffix "\n" (builtins.readFile filePath)); lib: filePath: lib.strings.trim (lib.strings.removeSuffix "\n" (builtins.readFile filePath));

13
shell.nix Normal file
View File

@ -0,0 +1,13 @@
{ pkgs }:
{
# The minimum amount of dependencies in order to run 'just switch-now'
default = pkgs.mkShell {
packages = with pkgs; [
just
git
git-crypt
nh
];
};
}