mirror of
https://github.com/sstent/vmimages.git
synced 2026-01-25 14:41:44 +00:00
sync
This commit is contained in:
119
configuration.nix
Normal file
119
configuration.nix
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
{self, ...} @ inputs:
|
||||||
|
with inputs; let
|
||||||
|
## Variable Declaration ##
|
||||||
|
# Supported Architectures
|
||||||
|
platforms = ["x86_64-linux"];
|
||||||
|
|
||||||
|
# NixOS Version
|
||||||
|
version = readFile ./.version;
|
||||||
|
|
||||||
|
# System Libraries
|
||||||
|
inherit (self) files;
|
||||||
|
inherit (lib) eachSystem filters;
|
||||||
|
inherit (builtins) head readFile;
|
||||||
|
inherit (lib.util) build map pack;
|
||||||
|
lib = library.lib.extend (final: prev:
|
||||||
|
{
|
||||||
|
inherit (flatpak.lib) flatpak;
|
||||||
|
deploy = deploy.lib;
|
||||||
|
filters = ignore.lib // {inherit (filter.lib) filter matchExt;};
|
||||||
|
hooks = hooks.lib;
|
||||||
|
image = generators.nixosGenerate;
|
||||||
|
wine = wine.lib;
|
||||||
|
util = import ./lib {
|
||||||
|
inherit self platforms;
|
||||||
|
lib = final;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// home.lib
|
||||||
|
// utils.lib);
|
||||||
|
in
|
||||||
|
eachSystem platforms (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}".stable;
|
||||||
|
|
||||||
|
# Channels
|
||||||
|
channels = {
|
||||||
|
stable = (build.channel stable [] ./packages/patches)."${system}";
|
||||||
|
unstable = (build.channel unstable [nur.overlay] [])."${system}";
|
||||||
|
wine = wine.packages."${system}";
|
||||||
|
gaming = gaming.packages."${system}";
|
||||||
|
apps = {
|
||||||
|
deploy = deploy.defaultPackage."${system}";
|
||||||
|
generators = generators.defaultPackage."${system}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# 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;};
|
||||||
|
})
|
||||||
|
// {
|
||||||
|
# Overrides
|
||||||
|
overlays = map.modules ./packages/overlays import;
|
||||||
|
|
||||||
|
## Custom Library Functions ##
|
||||||
|
lib = lib.util;
|
||||||
|
|
||||||
|
## Program Configuration and 'dotfiles' ##
|
||||||
|
# files = import ./files lib self.legacyPackages."${head platforms}";
|
||||||
|
|
||||||
|
## Custom Configuration Modules ##
|
||||||
|
nixosModules =
|
||||||
|
map.modules ./modules import
|
||||||
|
// {default = import ./modules {inherit version lib inputs files;};};
|
||||||
|
|
||||||
|
## Configuration Templates ##
|
||||||
|
# templates = import ./.templates lib;
|
||||||
|
|
||||||
|
## Device Configuration ##
|
||||||
|
# deploy = import ./modules/nix/deploy.nix {inherit self lib;};
|
||||||
|
# nixosConfigurations =
|
||||||
|
# map.modules ./devices (name: build.device (import name));
|
||||||
|
|
||||||
|
nixosConfigurations = {
|
||||||
|
Go3 = nixpkgs.lib.nixosSystem {
|
||||||
|
specialArgs = { inherit inputs outputs; };
|
||||||
|
modules = [
|
||||||
|
./hosts/WSL/Go3
|
||||||
|
];
|
||||||
|
};
|
||||||
|
StuPC = nixpkgs.lib.nixosSystem {
|
||||||
|
specialArgs = { inherit inputs outputs; };
|
||||||
|
modules = [
|
||||||
|
./hosts/WSL/StuPC
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
## Virtual Machines ##
|
||||||
|
# vmConfigurations =
|
||||||
|
# map.modules ./devices/vm (name:
|
||||||
|
# import name (head platforms) inputs self.channels."${head platforms}".stable);
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
89
flake.lock
generated
89
flake.lock
generated
@@ -1,5 +1,20 @@
|
|||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"filter": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1676294984,
|
||||||
|
"narHash": "sha256-hdLUa/3RH1VJ+gMUysQE0JGM4F2Q/tIIFbtoxAOurJQ=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "nix-filter",
|
||||||
|
"rev": "fc282c5478e4141842f9644c239a41cfe9586732",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "nix-filter",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flake-compat": {
|
"flake-compat": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
@@ -46,6 +61,21 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"flake-utils_3": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1644229661,
|
||||||
|
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"home-manager": {
|
"home-manager": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
@@ -67,6 +97,43 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"ignore": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1660459072,
|
||||||
|
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "gitignore.nix",
|
||||||
|
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "gitignore.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"library": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1674348806,
|
||||||
|
"narHash": "sha256-hKi7sFobRQg6sJxskRFCjt/d8gR+w0ClEWZatlr2rnw=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nixpkgs.lib",
|
||||||
|
"rev": "af5239f892ae6e1c8bb560b11ed874cebbd10696",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"ref": "master",
|
||||||
|
"repo": "nixpkgs.lib",
|
||||||
|
"rev": "af5239f892ae6e1c8bb560b11ed874cebbd10696",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixos-hardware": {
|
"nixos-hardware": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1677440795,
|
"lastModified": 1677440795,
|
||||||
@@ -184,13 +251,17 @@
|
|||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"filter": "filter",
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
|
"ignore": "ignore",
|
||||||
|
"library": "library",
|
||||||
"nixos-hardware": "nixos-hardware",
|
"nixos-hardware": "nixos-hardware",
|
||||||
"nixos-wsl": "nixos-wsl",
|
"nixos-wsl": "nixos-wsl",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||||
"sops-nix": "sops-nix",
|
"sops-nix": "sops-nix",
|
||||||
|
"utils": "utils_2",
|
||||||
"vscode-server": "vscode-server"
|
"vscode-server": "vscode-server"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -228,6 +299,24 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"utils_2": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils_3"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1657226504,
|
||||||
|
"narHash": "sha256-GIYNjuq4mJlFgqKsZ+YrgzWm0IpA4axA3MCrdKYj7gs=",
|
||||||
|
"owner": "gytis-ivaskevicius",
|
||||||
|
"repo": "flake-utils-plus",
|
||||||
|
"rev": "2bf0f91643c2e5ae38c1b26893ac2927ac9bd82a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "gytis-ivaskevicius",
|
||||||
|
"repo": "flake-utils-plus",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"vscode-server": {
|
"vscode-server": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": "nixpkgs_3"
|
"nixpkgs": "nixpkgs_3"
|
||||||
|
|||||||
34
flake.nix
34
flake.nix
@@ -29,21 +29,34 @@
|
|||||||
|
|
||||||
# homeage = {url = "github:jordanisaacs/homeage"; inputs.nixpkgs.follows = "nixpkgs";};
|
# homeage = {url = "github:jordanisaacs/homeage"; inputs.nixpkgs.follows = "nixpkgs";};
|
||||||
# Nix Library Functions
|
# Nix Library Functions
|
||||||
# library = {
|
library = {
|
||||||
# type = "github";
|
type = "github";
|
||||||
# owner = "nix-community";
|
owner = "nix-community";
|
||||||
# repo = "nixpkgs.lib";
|
repo = "nixpkgs.lib";
|
||||||
# ref = "master";
|
ref = "master";
|
||||||
# rev = "af5239f892ae6e1c8bb560b11ed874cebbd10696";
|
rev = "af5239f892ae6e1c8bb560b11ed874cebbd10696";
|
||||||
# };
|
};
|
||||||
|
# Source Filter Functions
|
||||||
|
filter.url = "github:numtide/nix-filter";
|
||||||
|
ignore = {
|
||||||
|
url = "github:hercules-ci/gitignore.nix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Flake Utility Functions
|
||||||
|
utils.url = "github:gytis-ivaskevicius/flake-utils-plus";
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, home-manager, ... }@inputs:
|
outputs = { self, nixpkgs, home-manager,library, ignore, filter,... }@inputs:
|
||||||
let
|
let
|
||||||
inherit (self) outputs;
|
inherit (self) outputs;
|
||||||
forEachSystem = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" ];
|
forEachSystem = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" ];
|
||||||
|
platforms = ["x86_64-linux"];
|
||||||
|
|
||||||
forEachPkgs = f: forEachSystem (sys: f nixpkgs.legacyPackages.${sys});
|
forEachPkgs = f: forEachSystem (sys: f nixpkgs.legacyPackages.${sys});
|
||||||
|
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
packages = forEachPkgs (pkgs: import ./pkgs { inherit pkgs; });
|
packages = forEachPkgs (pkgs: import ./pkgs { inherit pkgs; });
|
||||||
@@ -51,7 +64,8 @@
|
|||||||
overlays = import ./overlays { inherit inputs; };
|
overlays = import ./overlays { inherit inputs; };
|
||||||
nixosModules = import ./modules/nixos;
|
nixosModules = import ./modules/nixos;
|
||||||
homeManagerModules = import ./modules/home-manager;
|
homeManagerModules = import ./modules/home-manager;
|
||||||
# util = import ./lib/map.nix;
|
|
||||||
|
util = import ./lib/map.nix;
|
||||||
|
|
||||||
# NixOS configuration entrypoint
|
# NixOS configuration entrypoint
|
||||||
# Available through 'nixos-rebuild --flake .#your-hostname'
|
# Available through 'nixos-rebuild --flake .#your-hostname'
|
||||||
@@ -77,7 +91,7 @@
|
|||||||
# FIXME replace with your username@hostname
|
# FIXME replace with your username@hostname
|
||||||
"sstent@Go3" = home-manager.lib.homeManagerConfiguration {
|
"sstent@Go3" = home-manager.lib.homeManagerConfiguration {
|
||||||
pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
|
pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
|
||||||
extraSpecialArgs = { inherit inputs outputs; };
|
extraSpecialArgs = { inherit inputs outputs; hostName = "Go3"; };
|
||||||
modules = [
|
modules = [
|
||||||
# > Our main home-manager configuration file <
|
# > Our main home-manager configuration file <
|
||||||
./home-manager/users/sstent
|
./home-manager/users/sstent
|
||||||
|
|||||||
@@ -2,21 +2,21 @@
|
|||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
# inherit
|
inherit
|
||||||
# (builtins)
|
(builtins)
|
||||||
# attrNames
|
# attrNames
|
||||||
# attrValues
|
# attrValues
|
||||||
# foldl'
|
# foldl'
|
||||||
# isPath
|
# isPath
|
||||||
# pathExists
|
# pathExists
|
||||||
# readDir
|
readDir
|
||||||
# toString
|
# toString
|
||||||
# ;
|
;
|
||||||
|
|
||||||
# inherit
|
inherit
|
||||||
# (lib)
|
(lib)
|
||||||
# flatten
|
# flatten
|
||||||
# filterAttrs
|
filterAttrs
|
||||||
# forEach
|
# forEach
|
||||||
# getAttrFromPath
|
# getAttrFromPath
|
||||||
# hasPrefix
|
# hasPrefix
|
||||||
@@ -27,26 +27,26 @@ let
|
|||||||
# mkIf
|
# mkIf
|
||||||
# nameValuePair
|
# nameValuePair
|
||||||
# removeSuffix
|
# removeSuffix
|
||||||
# ;
|
;
|
||||||
cfg = config.custom.keybase;
|
cfg = config.custom.keybase;
|
||||||
username = config.home.username;
|
username = config.home.username;
|
||||||
secretstore = config._secretstore;
|
secretstore = config._secretstore;
|
||||||
util = import "${inputs.self}/lib";
|
# map = import "${inputs.self}/lib/map.nix";
|
||||||
|
|
||||||
# # 'sops' Encrypted Secrets
|
# 'sops' Encrypted Secrets
|
||||||
# hm_secrets = dir: out_dir:
|
hm_secrets = dir: out_dir:
|
||||||
# filter (name: type: type != null && !(hasPrefix "_" name)) (name: type:
|
filter (name: type: type != null && !(hasPrefix "_" name)) (name: type:
|
||||||
# if type == "regular"
|
if type == "regular"
|
||||||
# then
|
then
|
||||||
# nameValuePair name {
|
nameValuePair name {
|
||||||
# sopsFile = dir + "/${name}";
|
sopsFile = dir + "/${name}";
|
||||||
# format = "binary";
|
format = "binary";
|
||||||
# path = out_dir + "/${name}";
|
path = out_dir + "/${name}";
|
||||||
|
|
||||||
# }
|
}
|
||||||
# else nameValuePair "" null) (readDir dir);
|
else nameValuePair "" null) (readDir dir);
|
||||||
|
|
||||||
# filter = name: func: attrs: filterAttrs name (mapAttrs' func attrs);
|
filter = name: func: attrs: filterAttrs name (mapAttrs' func attrs);
|
||||||
|
|
||||||
|
|
||||||
in {
|
in {
|
||||||
@@ -70,7 +70,7 @@ in {
|
|||||||
systemd.user.services.kbfs.Unit.After = [ "sops-nix.service" ];
|
systemd.user.services.kbfs.Unit.After = [ "sops-nix.service" ];
|
||||||
|
|
||||||
sops = {
|
sops = {
|
||||||
secrets = util.map.hm_secrets "${secretstore}/user_dotfiles/${username}@${hostName}/keybase/" "${config.xdg.configHome}/keybase/";
|
secrets = hm_secrets "${secretstore}/user_dotfiles/${username}@${hostName}/keybase/" "${config.xdg.configHome}/keybase/";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user