addin ssh key

This commit is contained in:
2023-11-21 14:00:06 +00:00
parent 4178372853
commit 54c3d889ab
33 changed files with 873 additions and 829 deletions

View File

@@ -1,7 +1,12 @@
# This is your system's configuration file. # This is your system's configuration file.
# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) # Use this to configure your system environment (it replaces /etc/nixos/configuration.nix)
{
{ lib, config, pkgs, modulesPath, ... }: { lib,
config,
pkgs,
modulesPath,
...
}: {
# You can import other NixOS modules here # You can import other NixOS modules here
imports = [ imports = [
@@ -10,10 +15,9 @@
# Include static network settings. # Include static network settings.
./networking.nix ./networking.nix
"${modulesPath}/virtualisation/hyperv-image.nix" "${modulesPath}/virtualisation/hyperv-image.nix"
]; ];
nixpkgs = { config = { allowUnfree = true; }; }; nixpkgs = {config = {allowUnfree = true;};};
nix = { nix = {
settings = { settings = {
@@ -33,7 +37,7 @@
sshd.enable = true; sshd.enable = true;
}; };
networking.firewall.allowedTCPPorts = [ 22 ]; networking.firewall.allowedTCPPorts = [22];
environment.etc."ssh/ssh_host_rsa_key".source = ./ssh/ssh_host_rsa_key; environment.etc."ssh/ssh_host_rsa_key".source = ./ssh/ssh_host_rsa_key;
environment.etc."ssh/ssh_host_rsa_key".mode = "0400"; environment.etc."ssh/ssh_host_rsa_key".mode = "0400";
@@ -41,7 +45,4 @@
environment.etc."ssh/ssh_host_ed25519_key".source = ./ssh/ssh_host_ed25519_key; environment.etc."ssh/ssh_host_ed25519_key".source = ./ssh/ssh_host_ed25519_key;
environment.etc."ssh/ssh_host_ed25519_key".mode = "0400"; environment.etc."ssh/ssh_host_ed25519_key".mode = "0400";
environment.etc."ssh/ssh_host_ed25519_key.pub".source = ./ssh/ssh_host_ed25519_key.pub; environment.etc."ssh/ssh_host_ed25519_key.pub".source = ./ssh/ssh_host_ed25519_key.pub;
} }

View File

@@ -10,11 +10,10 @@
nixpkgs.hostPlatform = "x86_64-linux"; nixpkgs.hostPlatform = "x86_64-linux";
virtualisation.hypervGuest.videoMode = "1920x1080"; virtualisation.hypervGuest.videoMode = "1920x1080";
boot.initrd.availableKernelModules = [ "sd_mod" "sr_mod" ]; boot.initrd.availableKernelModules = ["sd_mod" "sr_mod"];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [];
boot.kernelModules = ["hv_sock"]; boot.kernelModules = ["hv_sock"];
# fileSystems."/" = { # fileSystems."/" = {
# device = "/dev/disk/by-label/nixos"; # device = "/dev/disk/by-label/nixos";
# autoResize = true; # autoResize = true;
@@ -35,5 +34,4 @@
# in ["${automount_opts},credentials=/etc/nixos/smb-secrets"]; # in ["${automount_opts},credentials=/etc/nixos/smb-secrets"];
in ["${automount_opts}"]; in ["${automount_opts}"];
}; };
} }

View File

@@ -1,11 +1,15 @@
{
{ lib, config, pkgs, ... }: { lib,
config,
pkgs,
...
}: {
# You can import other NixOS modules here # You can import other NixOS modules here
hyperv = { hyperv = {
baseImageSize = 8096; baseImageSize = 8096;
}; };
# environment.etc = { # environment.etc = {
# nixos.source = ../..; # nixos.source = ../..;
# }; # };
} }

View File

@@ -21,7 +21,10 @@
# nix-colors.url = "github:misterio77/nix-colors"; # nix-colors.url = "github:misterio77/nix-colors";
nixos-hardware.url = "github:NixOS/nixos-hardware"; # Import nixos hardware quirks settings nixos-hardware.url = "github:NixOS/nixos-hardware"; # Import nixos hardware quirks settings
# nixos-generators = { url = "github:nix-community/nixos-generators"; inputs.nixpkgs.follows = "nixpkgs";}; #import nixos-generators for building images # nixos-generators = { url = "github:nix-community/nixos-generators"; inputs.nixpkgs.follows = "nixpkgs";}; #import nixos-generators for building images
nixos-wsl = {url = "github:nix-community/nixos-wsl"; inputs.nixpkgs.follows = "nixpkgs";}; nixos-wsl = {
url = "github:nix-community/nixos-wsl";
inputs.nixpkgs.follows = "nixpkgs";
};
sops-nix.url = github:Mic92/sops-nix; sops-nix.url = github:Mic92/sops-nix;
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
# nix.url = "github:NixOS/nix/2.12.0"; # nix.url = "github:NixOS/nix/2.12.0";
@@ -45,44 +48,54 @@
# Flake Utility Functions # Flake Utility Functions
utils.url = "github:gytis-ivaskevicius/flake-utils-plus"; utils.url = "github:gytis-ivaskevicius/flake-utils-plus";
}; };
outputs = { self, nixpkgs, home-manager,nixpkgs-unstable,... }@inputs: outputs = {
let self,
nixpkgs,
home-manager,
nixpkgs-unstable,
...
} @ inputs: let
inherit (lib.my) mapModules mapModulesRec mapHosts; inherit (lib.my) mapModules mapModulesRec mapHosts;
inherit (self) outputs; inherit (self) outputs;
system = "x86_64-linux"; system = "x86_64-linux";
mkPkgs = pkgs: extraOverlays: import pkgs { mkPkgs = pkgs: extraOverlays:
import pkgs {
inherit system; inherit system;
config.allowUnfree = true; # forgive me Stallman senpai config.allowUnfree = true; # forgive me Stallman senpai
overlays = extraOverlays ++ (lib.attrValues self.overlays); overlays = extraOverlays ++ (lib.attrValues self.overlays);
}; };
pkgs = mkPkgs nixpkgs [ self.overlay ]; pkgs = mkPkgs nixpkgs [self.overlay];
pkgs' = mkPkgs nixpkgs-unstable []; pkgs' = mkPkgs nixpkgs-unstable [];
lib = nixpkgs.lib.extend lib =
(self: super: { my = import ./lib { inherit pkgs inputs outputs; lib = self; }; }// home-manager.lib); nixpkgs.lib.extend
(self: super:
{
my = import ./lib {
inherit pkgs inputs outputs;
lib = self;
};
}
// home-manager.lib);
in { in {
lib = lib.my; lib = lib.my;
packages."${system}" = packages."${system}" =
mapModules ./pkgs (p: pkgs.callPackage p {}); mapModules ./pkgs (p: pkgs.callPackage p {});
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
devShell."${system}" = devShell."${system}" =
import ./shell.nix { inherit pkgs; }; import ./shell.nix {inherit pkgs;};
overlay = overlay = final: prev: {
final: prev: {
#unstable = pkgs'; #unstable = pkgs';
my = self.packages."${system}"; my = self.packages."${system}";
}; };
overlays = import ./overlays { inherit inputs; }; overlays = import ./overlays {inherit inputs;};
# Output all modules in ./modules to flake. Modules should be in # Output all modules in ./modules to flake. Modules should be in
# individual subdirectories and contain a default.nix file # individual subdirectories and contain a default.nix file
@@ -93,7 +106,6 @@
}) })
(builtins.attrNames (builtins.readDir ./modules/nixos))); (builtins.attrNames (builtins.readDir ./modules/nixos)));
##import our HM modules ##import our HM modules
## -- imported in ./home-manger/general ## -- imported in ./home-manger/general
@@ -104,7 +116,6 @@
}) })
(builtins.attrNames (builtins.readDir ./modules/home-manager))); (builtins.attrNames (builtins.readDir ./modules/home-manager)));
# nixosConfigurations = # nixosConfigurations =
# mapHosts ./hosts {}; # mapHosts ./hosts {};
@@ -112,18 +123,23 @@
# Available through 'nixos-rebuild --flake .#your-hostname' # Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = { nixosConfigurations = {
go3-wsl = nixpkgs.lib.nixosSystem { go3-wsl = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs lib;hostName = "go3-wsl"; }; specialArgs = {
inherit inputs outputs lib;
hostName = "go3-wsl";
};
modules = [ modules = [
./hosts/go3-wsl ./hosts/go3-wsl
]; ];
}; };
StuPC-WSL = nixpkgs.lib.nixosSystem { StuPC-WSL = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs lib; hostName = "StuPC";}; specialArgs = {
inherit inputs outputs lib;
hostName = "StuPC";
};
modules = [ modules = [
./hosts/StuPC-WSL ./hosts/StuPC-WSL
]; ];
}; };
}; };
# Standalone home-manager configuration entrypoint # Standalone home-manager configuration entrypoint
@@ -133,7 +149,10 @@
"sstent@go3-wsl" = home-manager.lib.homeManagerConfiguration { "sstent@go3-wsl" = 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
pkgs = pkgs; pkgs = pkgs;
extraSpecialArgs = { inherit inputs outputs lib; hostName = "go3-wsl"; }; extraSpecialArgs = {
inherit inputs outputs lib;
hostName = "go3-wsl";
};
modules = [ modules = [
# > Our main home-manager configuration file < # > Our main home-manager configuration file <
./home-manager/users/sstent ./home-manager/users/sstent
@@ -143,7 +162,10 @@
"sstent@StuPC-WSL" = home-manager.lib.homeManagerConfiguration { "sstent@StuPC-WSL" = 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
pkgs = pkgs; pkgs = pkgs;
extraSpecialArgs = { inherit inputs outputs lib; hostName = "StuPC-WSL";}; extraSpecialArgs = {
inherit inputs outputs lib;
hostName = "StuPC-WSL";
};
modules = [ modules = [
# > Our main home-manager configuration file < # > Our main home-manager configuration file <
./home-manager/users/sstent ./home-manager/users/sstent
@@ -151,6 +173,5 @@
]; ];
}; };
}; };
}; };
} }

View File

@@ -1,65 +1,65 @@
{ inputs, lib, pkgs, config, outputs, ... }:
{ {
inputs,
imports = [ lib,
pkgs,
config,
outputs,
...
}: {
imports =
[
# ./beets.nix # ./beets.nix
# ./keybase.nix # ./keybase.nix
"${inputs.vscode-server}/modules/vscode-server/home.nix" "${inputs.vscode-server}/modules/vscode-server/home.nix"
] ++ (builtins.attrValues outputs.homeManagerModules); ]
++ (builtins.attrValues outputs.homeManagerModules);
###dotfiles path variable
###dotfiles path variable
options._dotfiles = lib.mkOption { options._dotfiles = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "${inputs.self}/home-manager/dotfiles"; default = "${inputs.self}/home-manager/dotfiles";
description = "Path to the dotfiles in this repository"; description = "Path to the dotfiles in this repository";
}; };
###secrets path variable ###secrets path variable
options._secrets = lib.mkOption { options._secrets = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "/run/user/1000/secrets/"; default = "/run/user/1000/secrets/";
description = "Path to the Secrets runtime"; description = "Path to the Secrets runtime";
}; };
###secretstore path variable
###secretstore path variable
options._secretstore = lib.mkOption { options._secretstore = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "${inputs.self}/secrets/"; default = "${inputs.self}/secrets/";
description = "Path to the Secrets storage"; description = "Path to the Secrets storage";
}; };
config = { config = {
nixpkgs = { nixpkgs = {
overlays = builtins.attrValues outputs.overlays; overlays = builtins.attrValues outputs.overlays;
config = { config = {
allowUnfree = true; allowUnfree = true;
allowUnfreePredicate = (_: true); allowUnfreePredicate = _: true;
}; };
}; };
nix = { nix = {
package = lib.mkDefault pkgs.nix; package = lib.mkDefault pkgs.nix;
settings = { settings = {
experimental-features = [ "nix-command" "flakes" "repl-flake" ]; experimental-features = ["nix-command" "flakes" "repl-flake"];
warn-dirty = false; warn-dirty = false;
}; };
}; };
##VSCode ##VSCode
services.vscode-server.enable = true; services.vscode-server.enable = true;
services.vscode-server.enableFHS = true; services.vscode-server.enableFHS = true;
services.vscode-server.nodejsPackage = pkgs.nodejs-18_x; services.vscode-server.nodejsPackage = pkgs.nodejs-18_x;
programs = { programs = {
home-manager.enable = true; home-manager.enable = true;
git.enable = true; git.enable = true;
}; };
}; };
} }

View File

@@ -1,7 +1,12 @@
{ inputs, outputs, lib, config, pkgs, hostName, ... }:
{ {
inputs,
outputs,
lib,
config,
pkgs,
hostName,
...
}: {
imports = [ imports = [
../../global.nix ../../global.nix
]; ];
@@ -10,7 +15,7 @@
home.stateVersion = "23.05"; home.stateVersion = "23.05";
sops = { sops = {
age.sshKeyPaths = [ "/home/sstent/.ssh/id_ed25519" ]; age.sshKeyPaths = ["/home/sstent/.ssh/id_ed25519"];
defaultSopsFile = "${config._secretstore}/user-secrets.yaml"; defaultSopsFile = "${config._secretstore}/user-secrets.yaml";
secrets = { secrets = {
mrconfig = { mrconfig = {
@@ -21,8 +26,6 @@
}; };
}; };
# home.file."/home/sstent/.config/beets/test".source = config.lib.file.mkOutOfStoreSymlink /run/user/1000/secrets/test; # home.file."/home/sstent/.config/beets/test".source = config.lib.file.mkOutOfStoreSymlink /run/user/1000/secrets/test;
# Let Home Manager install and manage itself. # Let Home Manager install and manage itself.
@@ -33,7 +36,7 @@
bitwarden-cli bitwarden-cli
ansible ansible
# sshpass # sshpass
(import ./python-packages.nix { pkgs = pkgs; }) (import ./python-packages.nix {pkgs = pkgs;})
pyinfra pyinfra
sshpass sshpass
nmap nmap
@@ -73,8 +76,8 @@
yt-dlp.enable = true; yt-dlp.enable = true;
bash = { bash = {
enable = true; enable = true;
historyControl = [ "ignorespace" ]; historyControl = ["ignorespace"];
shellOptions = [ "histappend" ]; shellOptions = ["histappend"];
sessionVariables = { sessionVariables = {
DOCKER_HOST = "tcp://192.168.1.223:2375"; DOCKER_HOST = "tcp://192.168.1.223:2375";
NOMAD_ADDR = "http://192.168.1.250:4646"; NOMAD_ADDR = "http://192.168.1.250:4646";
@@ -95,8 +98,7 @@
enable = true; enable = true;
userName = "sstent"; userName = "sstent";
userEmail = "stuart.stent@gmail.com"; userEmail = "stuart.stent@gmail.com";
extraConfig = { pull.rebase = true; }; extraConfig = {pull.rebase = true;};
}; };
ssh = { ssh = {
enable = true; enable = true;
@@ -114,9 +116,7 @@
}; };
}; };
}; };
} }
#######If Gnome #######If Gnome
# config = lib.mkIf config.mymods.gnome.enable { # config = lib.mkIf config.mymods.gnome.enable {
# programs.bash.enable = true; # programs.bash.enable = true;
@@ -166,7 +166,6 @@
# ]; # ];
# }; # };
# "org/gnome/desktop/interface" = { color-scheme = "prefer-dark"; }; # "org/gnome/desktop/interface" = { color-scheme = "prefer-dark"; };
# }; # };
# }; # };

View File

@@ -1,7 +1,7 @@
{ pkgs }: {pkgs}:
pkgs.python3.withPackages (p:
pkgs.python3.withPackages (p: with p; [ with p; [
requests # HTTP library requests # HTTP library
setuptools # setup.py setuptools # setup.py
paramiko # ssh library paramiko # ssh library
]) ])

View File

@@ -1,5 +1,10 @@
{ lib, pkgs, config, inputs, ... }: { {
lib,
pkgs,
config,
inputs,
...
}: {
imports = [ imports = [
../common.nix ../common.nix
../user-sstent.nix ../user-sstent.nix
@@ -15,6 +20,4 @@
syncthing.enable = true; syncthing.enable = true;
wsl.enable = true; wsl.enable = true;
}; };
} }

View File

@@ -1,46 +1,51 @@
# This file (and the global directory) holds config that i use on all hosts # This file (and the global directory) holds config that i use on all hosts
{ lib, inputs, outputs, pkgs, config, ... }:
{ {
imports = [ lib,
inputs,
outputs,
pkgs,
config,
...
}: {
imports =
[
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
]++ (builtins.attrValues outputs.nixosModules); ]
++ (builtins.attrValues outputs.nixosModules);
###dotfiles path variable ###dotfiles path variable
options._dotfiles = lib.mkOption { options._dotfiles = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "${inputs.self}/home-manager/dotfiles"; default = "${inputs.self}/home-manager/dotfiles";
description = "Path to the dotfiles in this repository"; description = "Path to the dotfiles in this repository";
}; };
###secrets path variable ###secrets path variable
options._secrets = lib.mkOption { options._secrets = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "/run/user/1000/secrets"; default = "/run/user/1000/secrets";
description = "Path to the Secrets runtime"; description = "Path to the Secrets runtime";
}; };
###secretstore path variable
###secretstore path variable
options._secretstore = lib.mkOption { options._secretstore = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "${inputs.self}/secrets"; default = "${inputs.self}/secrets";
description = "Path to the Secrets storage"; description = "Path to the Secrets storage";
}; };
config = { config = {
system.stateVersion = "23.05"; system.stateVersion = "23.05";
sops = { sops = {
defaultSopsFile = "${config._secretstore}/host-secrets.yaml"; defaultSopsFile = "${config._secretstore}/host-secrets.yaml";
age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ]; age.sshKeyPaths = ["/etc/ssh/ssh_host_ed25519_key"];
}; };
home-manager = { home-manager = {
useUserPackages = true; useUserPackages = true;
extraSpecialArgs = { inherit inputs outputs; }; extraSpecialArgs = {inherit inputs outputs;};
sharedModules = [ sharedModules = [
inputs.sops-nix.homeManagerModules.sops inputs.sops-nix.homeManagerModules.sops
]; ];
@@ -56,12 +61,11 @@ config = {
nix.extraOptions = '' nix.extraOptions = ''
experimental-features = nix-command flakes experimental-features = nix-command flakes
''; '';
nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; nix.nixPath = ["nixpkgs=${inputs.nixpkgs}"];
# nix.nixPath = [ "nixpkgs=pkgs.outPath" ]; # nix.nixPath = [ "nixpkgs=pkgs.outPath" ];
networking.search = ["node.dc1.consul" "service.dc1.consul"]; networking.search = ["node.dc1.consul" "service.dc1.consul"];
#services.envfs.enable = true;
#services.envfs.enable = true;
environment.systemPackages = [ environment.systemPackages = [
pkgs.git pkgs.git
pkgs.home-manager pkgs.home-manager
@@ -71,11 +75,10 @@ nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
pkgs.bitwarden-cli pkgs.bitwarden-cli
]; ];
nix.gc = { nix.gc = {
automatic = true; # Enable the automatic garbage collector automatic = true; # Enable the automatic garbage collector
dates = "03:15"; # When to run the garbage collector dates = "03:15"; # When to run the garbage collector
options = "-d"; # Arguments to pass to nix-collect-garbage options = "-d"; # Arguments to pass to nix-collect-garbage
}; };
};
};
} }

View File

@@ -1,5 +1,10 @@
{ lib, pkgs, config, inputs, ... }: { {
lib,
pkgs,
config,
inputs,
...
}: {
imports = [ imports = [
../common.nix ../common.nix
../user-sstent.nix ../user-sstent.nix
@@ -16,5 +21,4 @@
syncthing.enable = true; syncthing.enable = true;
wsl.enable = true; wsl.enable = true;
}; };
} }

View File

@@ -1,6 +1,9 @@
{ inputs, lib, config, ... }:
{ {
inputs,
lib,
config,
...
}: {
sops.secrets.sstent_password = { sops.secrets.sstent_password = {
#sopsFile = ./secrets.yaml; #sopsFile = ./secrets.yaml;
neededForUsers = true; neededForUsers = true;
@@ -15,11 +18,9 @@
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+D4o3mL4BQsRr0UIhB1hn0brSTIJ9Lr0m2fMMVGF3tIuEihnmwGTeAX78q5/bmoo4gZy7G+CHal54S1lY8LY1KvmIDCpPJ8848HvLbTiTX3qZ7Mjaav+Ox9eHMwX+7zkPwdhfP8TDvmNe12j1GEKBhAm+FhdBQCbEV7cbm1SkX0+WBGoVvI2qbRm1RF0mOuTAmO3Lr2YeAcKJ21YxwNMv1Qrj7oxGYH9rLHLNwZ/0soIdTC9cikl4DHyvCs4HRYcVw36uuCVc/AyIT2GeETRapAQr8nzT89Haa1IThgZ9ztjSsSSOtrUhxatlMIfTIpVjl/gWq7GLfqd/ei/evTal sstent@StuPC" "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+D4o3mL4BQsRr0UIhB1hn0brSTIJ9Lr0m2fMMVGF3tIuEihnmwGTeAX78q5/bmoo4gZy7G+CHal54S1lY8LY1KvmIDCpPJ8848HvLbTiTX3qZ7Mjaav+Ox9eHMwX+7zkPwdhfP8TDvmNe12j1GEKBhAm+FhdBQCbEV7cbm1SkX0+WBGoVvI2qbRm1RF0mOuTAmO3Lr2YeAcKJ21YxwNMv1Qrj7oxGYH9rLHLNwZ/0soIdTC9cikl4DHyvCs4HRYcVw36uuCVc/AyIT2GeETRapAQr8nzT89Haa1IThgZ9ztjSsSSOtrUhxatlMIfTIpVjl/gWq7GLfqd/ei/evTal sstent@StuPC"
]; ];
extraGroups = [ "wheel" "video" ]; extraGroups = ["wheel" "video"];
}; };
}; };
# home-manager.users.misterio = import home/${config.networking.hostName}.nix; # home-manager.users.misterio = import home/${config.networking.hostName}.nix;
} }

View File

@@ -1,11 +1,9 @@
{ lib, ... }: {lib, ...}:
with builtins; with builtins;
with lib; with lib; rec {
rec {
# attrsToList # attrsToList
attrsToList = attrs: attrsToList = attrs:
mapAttrsToList (name: value: { inherit name value; }) attrs; mapAttrsToList (name: value: {inherit name value;}) attrs;
# mapFilterAttrs :: # mapFilterAttrs ::
# (name -> value -> bool) # (name -> value -> bool)

View File

@@ -10,24 +10,28 @@
# map = callLibs ./map.nix; # map = callLibs ./map.nix;
# ## In configs, they can be used under "lib.our" # ## In configs, they can be used under "lib.our"
# }) # })
{
inputs,
lib,
{ inputs, lib, pkgs, ... }: pkgs,
...
let }: let
inherit (lib) makeExtensible attrValues foldr; inherit (lib) makeExtensible attrValues foldr;
inherit (modules) mapModules; inherit (modules) mapModules;
modules = import ./modules.nix { modules = import ./modules.nix {
inherit lib; inherit lib;
self.attrs = import ./attrs.nix { inherit lib; self = {}; }; self.attrs = import ./attrs.nix {
inherit lib;
self = {};
};
}; };
mylib = makeExtensible (self: mylib = makeExtensible (self:
with self; mapModules ./. with self;
(file: import file { inherit self lib pkgs inputs; })); mapModules ./.
(file: import file {inherit self lib pkgs inputs;}));
in in
mylib.extend mylib.extend
(self: super: (self: super:
foldr (a: b: a // b) {} (attrValues super)) foldr (a: b: a // b) {} (attrValues super))

View File

@@ -1,13 +1,15 @@
{ lib, pkgs, ... }:
with builtins;
with lib;
{ {
toCSSFile = file: lib,
let fileName = removeSuffix ".scss" (baseNameOf file); pkgs,
...
}:
with builtins;
with lib; {
toCSSFile = file: let
fileName = removeSuffix ".scss" (baseNameOf file);
compiledStyles = compiledStyles =
pkgs.runCommand "compileScssFile" pkgs.runCommand "compileScssFile"
{ buildInputs = [ pkgs.sass ]; } '' {buildInputs = [pkgs.sass];} ''
mkdir "$out" mkdir "$out"
scss --sourcemap=none \ scss --sourcemap=none \
--no-cache \ --no-cache \
@@ -18,11 +20,11 @@ with lib;
''; '';
in "${compiledStyles}/${fileName}.css"; in "${compiledStyles}/${fileName}.css";
toFilteredImage = imageFile: options: toFilteredImage = imageFile: options: let
let result = "result.png"; result = "result.png";
filteredImage = filteredImage =
pkgs.runCommand "filterWallpaper" pkgs.runCommand "filterWallpaper"
{ buildInputs = [ pkgs.imagemagick ]; } '' {buildInputs = [pkgs.imagemagick];} ''
mkdir "$out" mkdir "$out"
convert ${options} ${imageFile} $out/${result} convert ${options} ${imageFile} $out/${result}
''; '';

View File

@@ -11,7 +11,6 @@
hasSuffix hasSuffix
mapAttrs' mapAttrs'
nameValuePair nameValuePair
; ;
in rec { in rec {
filter = name: func: attrs: filterAttrs name (mapAttrs' func attrs); filter = name: func: attrs: filterAttrs name (mapAttrs' func attrs);
@@ -26,7 +25,6 @@ in rec {
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);
} }

View File

@@ -1,23 +1,28 @@
{ self, lib, ... }: {
self,
let lib,
...
}: let
inherit (builtins) attrValues readDir pathExists concatLists; inherit (builtins) attrValues readDir pathExists concatLists;
inherit (lib) id mapAttrsToList filterAttrs hasPrefix hasSuffix nameValuePair removeSuffix; inherit (lib) id mapAttrsToList filterAttrs hasPrefix hasSuffix nameValuePair removeSuffix;
inherit (self.attrs) mapFilterAttrs; inherit (self.attrs) mapFilterAttrs;
in in rec {
rec {
mapModules = dir: fn: mapModules = dir: fn:
mapFilterAttrs mapFilterAttrs
(n: v: (n: v:
v != null && v
!(hasPrefix "_" n)) != null
(n: v: && !(hasPrefix "_" n))
let path = "${toString dir}/${n}"; in (n: v: let
path = "${toString dir}/${n}";
in
if v == "directory" && pathExists "${path}/default.nix" if v == "directory" && pathExists "${path}/default.nix"
then nameValuePair n (fn path) then nameValuePair n (fn path)
else if v == "regular" && else if
n != "default.nix" && v
hasSuffix ".nix" n == "regular"
&& n != "default.nix"
&& hasSuffix ".nix" n
then nameValuePair (removeSuffix ".nix" n) (fn path) then nameValuePair (removeSuffix ".nix" n) (fn path)
else nameValuePair "" null) else nameValuePair "" null)
(readDir dir); (readDir dir);
@@ -28,10 +33,12 @@ rec {
mapModulesRec = dir: fn: mapModulesRec = dir: fn:
mapFilterAttrs mapFilterAttrs
(n: v: (n: v:
v != null && v
!(hasPrefix "_" n)) != null
(n: v: && !(hasPrefix "_" n))
let path = "${toString dir}/${n}"; in (n: v: let
path = "${toString dir}/${n}";
in
if v == "directory" if v == "directory"
then nameValuePair n (mapModulesRec path fn) then nameValuePair n (mapModulesRec path fn)
else if v == "regular" && n != "default.nix" && hasSuffix ".nix" n else if v == "regular" && n != "default.nix" && hasSuffix ".nix" n
@@ -39,8 +46,7 @@ rec {
else nameValuePair "" null) else nameValuePair "" null)
(readDir dir); (readDir dir);
mapModulesRec' = dir: fn: mapModulesRec' = dir: fn: let
let
dirs = dirs =
mapAttrsToList mapAttrsToList
(k: _: "${dir}/${k}") (k: _: "${dir}/${k}")
@@ -49,5 +55,6 @@ rec {
(readDir dir)); (readDir dir));
files = attrValues (mapModules dir id); files = attrValues (mapModules dir id);
paths = files ++ concatLists (map (d: mapModulesRec' d id) dirs); paths = files ++ concatLists (map (d: mapModulesRec' d id) dirs);
in map fn paths; in
map fn paths;
} }

View File

@@ -1,25 +1,29 @@
{ inputs, lib, pkgs, ... }: {
inputs,
lib,
pkgs,
...
}:
with lib; with lib;
with lib.my; with lib.my; let
let sys = "x86_64-linux"; sys = "x86_64-linux";
in { in {
mkHost = path: attrs @ { system ? sys, ... }: mkHost = path: attrs @ {system ? sys, ...}:
nixosSystem { nixosSystem {
inherit system; inherit system;
specialArgs = { inherit lib inputs system; }; specialArgs = {inherit lib inputs system;};
modules = [ modules = [
{ {
nixpkgs.pkgs = pkgs; nixpkgs.pkgs = pkgs;
networking.hostName = mkDefault (removeSuffix ".nix" (baseNameOf path)); networking.hostName = mkDefault (removeSuffix ".nix" (baseNameOf path));
} }
(filterAttrs (n: v: !elem n [ "system" ]) attrs) (filterAttrs (n: v: !elem n ["system"]) attrs)
../. # /default.nix ../. # /default.nix
(import path) (import path)
]; ];
}; };
mapHosts = dir: attrs @ { system ? system, ... }: mapHosts = dir: attrs @ {system ? system, ...}:
mapModules dir mapModules dir
(hostPath: mkHost hostPath attrs); (hostPath: mkHost hostPath attrs);
} }

View File

@@ -1,16 +1,14 @@
{ lib, ... }: {lib, ...}: let
let
inherit (lib) mkOption types; inherit (lib) mkOption types;
in in rec {
rec {
mkOpt = type: default: mkOpt = type: default:
mkOption { inherit type default; }; mkOption {inherit type default;};
mkOpt' = type: default: description: mkOpt' = type: default: description:
mkOption { inherit type default description; }; mkOption {inherit type default description;};
mkBoolOpt = default: mkOption { mkBoolOpt = default:
mkOption {
inherit default; inherit default;
type = types.bool; type = types.bool;
example = true; example = true;

View File

@@ -1,7 +1,11 @@
{ config, pkgs, lib, ... }: {
with lib; config,
pkgs,
let cfg = config.custom.beets; lib,
...
}:
with lib; let
cfg = config.custom.beets;
in { in {
options.custom.beets = { options.custom.beets = {
enable = mkOption { enable = mkOption {
@@ -16,7 +20,6 @@ in {
pkgs.ffmpeg # for replaygain pkgs.ffmpeg # for replaygain
]; ];
sops = { sops = {
secrets.discogs_json = { secrets.discogs_json = {
path = "${config.xdg.configHome}/beets/discogs_token.json"; path = "${config.xdg.configHome}/beets/discogs_token.json";
@@ -48,12 +51,12 @@ in {
bracket = "[]"; bracket = "[]";
ignore_va = "compilation"; ignore_va = "compilation";
types = [ types = [
{ ep = "EP"; } {ep = "EP";}
{ single = "Single"; } {single = "Single";}
{ soundtrack = "OST"; } {soundtrack = "OST";}
{ live = "Live"; } {live = "Live";}
{ compilation = "Anthology"; } {compilation = "Anthology";}
{ remix = "Remix"; } {remix = "Remix";}
]; ];
}; };
aunique = { aunique = {
@@ -61,9 +64,9 @@ in {
disambiguators = "media"; disambiguators = "media";
keys = "albumartist album"; keys = "albumartist album";
}; };
copyartifacts = { extensions = ".cue .log .jpg .jpeg .png .txt"; }; copyartifacts = {extensions = ".cue .log .jpg .jpeg .png .txt";};
directory = "/mnt/q/CleanMusic/"; directory = "/mnt/q/CleanMusic/";
embedart = { auto = true; }; embedart = {auto = true;};
extrafiles = { extrafiles = {
paths = { paths = {
artworkdir = "$albumpath/Artwork"; artworkdir = "$albumpath/Artwork";
@@ -73,7 +76,7 @@ in {
}; };
patterns = { patterns = {
all = "*.*"; all = "*.*";
artworkdir = [ "[sS]cans/" "[aA]rtwork/" "[aA]rt/" "[cC]over/" ]; artworkdir = ["[sS]cans/" "[aA]rtwork/" "[aA]rt/" "[cC]over/"];
}; };
}; };
fetchart = { fetchart = {
@@ -93,8 +96,7 @@ in {
isMultidisc = "1 if disctotal > 1 else 0"; isMultidisc = "1 if disctotal > 1 else 0";
myBitDepth = "('' if bitdepth != 24 else '[24bit - '+ media + ']')"; myBitDepth = "('' if bitdepth != 24 else '[24bit - '+ media + ']')";
myDisc = "('' if disctotal <= 1 else str(disc) + ' - ')"; myDisc = "('' if disctotal <= 1 else str(disc) + ' - ')";
mySongartist = mySongartist = "artist + ' - ' if artist != albumartist and artist != '' else ''";
"artist + ' - ' if artist != albumartist and artist != '' else ''";
}; };
library = "~/musiclibrary.db"; library = "~/musiclibrary.db";
match = { match = {
@@ -123,8 +125,7 @@ in {
}; };
missing = { missing = {
format_album = "$albumartist: ($year) $album $albumtype $atype"; format_album = "$albumartist: ($year) $album $albumtype $atype";
format_item = format_item = "$albumartist - $album [$albumtype]$atype: $track/$tracktotal $title";
"$albumartist - $album [$albumtype]$atype: $track/$tracktotal $title";
}; };
musicbrainz = { musicbrainz = {
pass = "7ANCLPczDNFn6Sf65vdZ"; pass = "7ANCLPczDNFn6Sf65vdZ";
@@ -132,12 +133,9 @@ in {
}; };
original_date = true; original_date = true;
paths = { paths = {
"albumtype:soundtrack" = "albumtype:soundtrack" = "Soundtracks/$albumartist - $album%aunique{} ($year)/$myDisc$track - $artist - $title";
"Soundtracks/$albumartist - $album%aunique{} ($year)/$myDisc$track - $artist - $title"; comp = "Compilations/$albumartist/($year) $album%aunique{}/$myDisc$track - $artist - $title";
comp = default = "%if{$artist_grouping,$artist_grouping/}$first_artist/$year - $album $atype%aunique{media}[%upper{$format}$bitdepth]%if{$media,[$media]}/%if{$isMultidisc,$disc - }$track - $mySongartist$title";
"Compilations/$albumartist/($year) $album%aunique{}/$myDisc$track - $artist - $title";
default =
"%if{$artist_grouping,$artist_grouping/}$first_artist/$year - $album $atype%aunique{media}[%upper{$format}$bitdepth]%if{$media,[$media]}/%if{$isMultidisc,$disc - }$track - $mySongartist$title";
}; };
per_disc_numbering = true; per_disc_numbering = true;
plugins = [ plugins = [
@@ -160,19 +158,15 @@ in {
rewrite = { rewrite = {
"artist Björk & Tríó Guðmundar Ingólfssonar" = "Björk"; "artist Björk & Tríó Guðmundar Ingólfssonar" = "Björk";
"artist Brant Bjork and The Low Desert Punk Band" = "Brant Bjork"; "artist Brant Bjork and The Low Desert Punk Band" = "Brant Bjork";
"artist King Gizzard & The Lizard Wizard with Mild High Club" = "artist King Gizzard & The Lizard Wizard with Mild High Club" = "King Gizzard & The Lizard Wizard";
"King Gizzard & The Lizard Wizard";
"artist Kyuss _ Queens of the Stone Age" = "Kyuss"; "artist Kyuss _ Queens of the Stone Age" = "Kyuss";
"artist Professor Elemental & Tom Caruana" = "Professor Elemental"; "artist Professor Elemental & Tom Caruana" = "Professor Elemental";
"artist Resin Dogs Feat Spikey Tee" = "Resin Dogs"; "artist Resin Dogs Feat Spikey Tee" = "Resin Dogs";
"artist Sepultura _ Exodus" = "Sepultura"; "artist Sepultura _ Exodus" = "Sepultura";
"artist The Knife in collaboration with Mount Sims and Planningtorock" = "artist The Knife in collaboration with Mount Sims and Planningtorock" = "The Knife";
"The Knife";
"artist Unida _ Dozer" = "Unida"; "artist Unida _ Dozer" = "Unida";
}; };
}; };
}; };
}; };
} }

View File

@@ -1,11 +1,17 @@
{ config, pkgs, inputs, lib, util, hostName, ... }: {
config,
pkgs,
inputs,
lib,
util,
hostName,
...
}:
with lib; with lib;
with lib.my; with lib.my; let
let cfg = config.custom.keybase;
cfg = config.custom.keybase; username = config.home.username;
username = config.home.username; secretstore = config._secretstore;
secretstore = config._secretstore;
in { in {
options.custom.keybase = { options.custom.keybase = {
enable = mkOption { enable = mkOption {
@@ -15,16 +21,14 @@ in {
}; };
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
services.keybase.enable = true; services.keybase.enable = true;
services.kbfs.enable = true; services.kbfs.enable = true;
systemd.user.services.keybase.Unit.After = [ "sops-nix.service" ]; systemd.user.services.keybase.Unit.After = ["sops-nix.service"];
systemd.user.services.kbfs.Unit.After = [ "sops-nix.service" ]; systemd.user.services.kbfs.Unit.After = ["sops-nix.service"];
sops = { sops = {
secrets = 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/";
}; };
}; };
} }

View File

@@ -1,7 +1,11 @@
{ lib, pkgs, config, ... }: {
with lib; lib,
pkgs,
let cfg = config.custom.ssh-proxy; config,
...
}:
with lib; let
cfg = config.custom.ssh-proxy;
in { in {
options.custom.ssh-proxy = { options.custom.ssh-proxy = {
enable = mkOption { enable = mkOption {
@@ -14,31 +18,28 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [
npiperelay npiperelay
socat socat
]; ];
systemd.user = { systemd.user = {
startServices = true; startServices = true;
services.ssh-proxy = { services.ssh-proxy = {
Unit = { Description = "WSL Proxy"; After = "sops-nix.service";}; Unit = {
Install = { WantedBy = [ "default.target" ]; }; Description = "WSL Proxy";
After = "sops-nix.service";
};
Install = {WantedBy = ["default.target"];};
Service = { Service = {
ExecStart = "${pkgs.writeShellScript "start-proxy" '' ExecStart = "${pkgs.writeShellScript "start-proxy" ''
set -x -o xtrace # print commands set -x -o xtrace # print commands
${pkgs.coreutils}/bin/rm -f /home/sstent/.ssh/wsl-ssh-agent.sock ${pkgs.coreutils}/bin/rm -f /home/sstent/.ssh/wsl-ssh-agent.sock
${pkgs.util-linux}/bin/setsid ${pkgs.socat}/bin/socat UNIX-LISTEN:/home/sstent/.ssh/wsl-ssh-agent.sock,fork EXEC:"${pkgs.npiperelay}/bin/npiperelay.exe -ei -s //./pipe/openssh-ssh-agent",nofork ${pkgs.util-linux}/bin/setsid ${pkgs.socat}/bin/socat UNIX-LISTEN:/home/sstent/.ssh/wsl-ssh-agent.sock,fork EXEC:"${pkgs.npiperelay}/bin/npiperelay.exe -ei -s //./pipe/openssh-ssh-agent",nofork
''}"; ''}";
}; };
}; };
}; };
}; };
} }

View File

@@ -1,13 +1,16 @@
{ lib, inputs, outputs, config, ... }: {
with lib; lib,
inputs,
let cfg = config.custom.mnt_public; outputs,
config,
...
}:
with lib; let
cfg = config.custom.mnt_public;
in { in {
options.custom.mnt_public.enable = mkEnableOption "Enable mnt/Public"; options.custom.mnt_public.enable = mkEnableOption "Enable mnt/Public";
config = mkIf cfg.enable { config = mkIf cfg.enable {
fileSystems."/mnt/Public" = { fileSystems."/mnt/Public" = {
device = "//192.168.1.109/Public"; device = "//192.168.1.109/Public";
fsType = "cifs"; fsType = "cifs";
@@ -16,4 +19,3 @@ in {
}; };
}; };
} }

View File

@@ -1,20 +1,22 @@
{ lib, pkgs, config, ... }: {
with lib; lib,
pkgs,
let cfg = config.custom.sshd; config,
...
}:
with lib; let
cfg = config.custom.sshd;
in { in {
#define option to enable this #define option to enable this
options.custom.sshd.enable = mkEnableOption "Enable SSH"; options.custom.sshd.enable = mkEnableOption "Enable SSH";
config = mkIf cfg.enable { config = mkIf cfg.enable {
services.openssh = { services.openssh = {
enable = true; enable = true;
permitRootLogin = "no"; permitRootLogin = "no";
passwordAuthentication = false; passwordAuthentication = false;
}; };
networking.firewall.allowedTCPPorts = [ 22 ]; networking.firewall.allowedTCPPorts = [22];
};
};
} }

View File

@@ -1,13 +1,17 @@
{ lib, inputs, outputs, config, ... }: {
with lib; lib,
inputs,
let cfg = config.custom.syncthing; outputs,
config,
...
}:
with lib; let
cfg = config.custom.syncthing;
in { in {
options.custom.syncthing.enable = mkEnableOption "Enable mnt/Public"; options.custom.syncthing.enable = mkEnableOption "Enable mnt/Public";
config = mkIf cfg.enable { config = mkIf cfg.enable {
services.syncthing = {
services.syncthing = {
enable = true; enable = true;
dataDir = "/home/sstent"; dataDir = "/home/sstent";
openDefaultPorts = true; openDefaultPorts = true;
@@ -19,15 +23,15 @@ services.syncthing = {
overrideDevices = true; overrideDevices = true;
overrideFolders = true; overrideFolders = true;
devices = { devices = {
"StuPC" = { id = "Z43MPGF-OKG6K34-WTTFUDO-UG6E3TE-YCLSOAT-5LN5KMW-QHL2VSK-EZCGCAP"; }; "StuPC" = {id = "Z43MPGF-OKG6K34-WTTFUDO-UG6E3TE-YCLSOAT-5LN5KMW-QHL2VSK-EZCGCAP";};
"go3" = { id = "YDOL433-AHAL33M-NWLLDDQ-2D36ZIE-YNZVTKE-25TRBZ2-JXRSN7Y-Z5EOVQN"; }; "go3" = {id = "YDOL433-AHAL33M-NWLLDDQ-2D36ZIE-YNZVTKE-25TRBZ2-JXRSN7Y-Z5EOVQN";};
}; };
folders = { folders = {
"default" = { "default" = {
path = "/home/sstent/sync"; path = "/home/sstent/sync";
devices = [ "StuPC" "go3" ]; devices = ["StuPC" "go3"];
};
}; };
}; };
};
}; };
} }

View File

@@ -1,19 +1,20 @@
{ lib, pkgs, config, ... }: {
with lib; lib,
pkgs,
config,
...
}:
with lib; let
secretstore = config._secretstore;
host = config.networking.hostName;
let cfg = config.custom.mullvad;
secretstore = config._secretstore;
host = config.networking.hostName;
cfg = config.custom.mullvad;
secret = if builtins.pathExists "${secretstore}/hosts/${host}/mullvad/device.json" then
./secrets.nix
else
{ };
secret =
if builtins.pathExists "${secretstore}/hosts/${host}/mullvad/device.json"
then ./secrets.nix
else {};
in { in {
#define option to enable this #define option to enable this
options.custom.mullvad.enable = mkEnableOption "Enable SSH"; options.custom.mullvad.enable = mkEnableOption "Enable SSH";
@@ -33,9 +34,5 @@ in {
${pkgs.mullvad}/bin/mullvad relay set location ca mtr ${pkgs.mullvad}/bin/mullvad relay set location ca mtr
''; '';
}; };
};
};
} }

View File

@@ -1,23 +1,18 @@
{ lib, pkgs, config, ... }: {
with lib; lib,
pkgs,
let config,
secretstore = config._secretstore; ...
host = config.networking.hostName; }:
secretpath = "${secretstore}/hosts/${host}/mullvad/device.json"; with lib; let
secretstore = config._secretstore;
host = config.networking.hostName;
secretpath = "${secretstore}/hosts/${host}/mullvad/device.json";
in { in {
sops.secrets.device_json = {
sops.secrets.device_json= {
sopsFile = "${secretstore}/hosts/${host}/mullvad/device.json"; sopsFile = "${secretstore}/hosts/${host}/mullvad/device.json";
device_json.format = "binary"; device_json.format = "binary";
}; };
environment.etc."mullvad-vpn/device.conf".source = config.sops.secrets.device_json.path; environment.etc."mullvad-vpn/device.conf".source = config.sops.secrets.device_json.path;
} }

View File

@@ -1,12 +1,17 @@
{ lib, inputs, outputs, config, pkgs, ... }: {
with lib; lib,
inputs,
let cfg = config.custom.wsl; outputs,
config,
pkgs,
...
}:
with lib; let
cfg = config.custom.wsl;
in { in {
options.custom.wsl.enable = mkEnableOption "Enable WSL2 settings"; options.custom.wsl.enable = mkEnableOption "Enable WSL2 settings";
config = mkIf cfg.enable { config = mkIf cfg.enable {
# Enable native Docker support # Enable native Docker support
virtualisation.docker.enable = true; virtualisation.docker.enable = true;
@@ -46,11 +51,7 @@ in {
"/run/wrappers/bin/mount --bind -o X-mount.mkdir /run/shm /dev/shm" "/run/wrappers/bin/mount --bind -o X-mount.mkdir /run/shm /dev/shm"
]; ];
}; };
wantedBy = [ "sysinit.target" ]; wantedBy = ["sysinit.target"];
}; };
}; };
} }

View File

@@ -1,8 +1,9 @@
# A nixpkgs instance that is grabbed from the pinned nixpkgs commit in the lock file # A nixpkgs instance that is grabbed from the pinned nixpkgs commit in the lock file
# This is useful to avoid using channels when using legacy nix commands # This is useful to avoid using channels when using legacy nix commands
let lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked; let
lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked;
in in
import (fetchTarball { import (fetchTarball {
url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz"; url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz";
sha256 = lock.narHash; sha256 = lock.narHash;
}) })

View File

@@ -1,8 +1,7 @@
# This file defines overlays # This file defines overlays
{ inputs, ... }: {inputs, ...}: {
{
# This one brings our custom packages from the 'pkgs' directory # This one brings our custom packages from the 'pkgs' directory
additions = final: _prev: import ../pkgs { pkgs = final; }; additions = final: _prev: import ../pkgs {pkgs = final;};
# This one contains whatever you want to overlay # This one contains whatever you want to overlay
# You can change versions, add patches, set compilation flags, anything really. # You can change versions, add patches, set compilation flags, anything really.

View File

@@ -1,8 +1,6 @@
# Custom packages, that can be defined similarly to ones from nixpkgs # Custom packages, that can be defined similarly to ones from nixpkgs
# You can build them using 'nix build .#example' or (legacy) 'nix-build -A example' # You can build them using 'nix build .#example' or (legacy) 'nix-build -A example'
{pkgs ? (import ../nixpkgs.nix) {}}: {
{ pkgs ? (import ../nixpkgs.nix) { } }: {
# example = pkgs.callPackage ./example { }; # example = pkgs.callPackage ./example { };
npiperelay = pkgs.callPackage ./npiperelay { }; npiperelay = pkgs.callPackage ./npiperelay {};
} }

View File

@@ -1,11 +1,13 @@
{ lib, stdenv, fetchurl ,unzip }: {
lib,
let stdenv,
fetchurl,
unzip,
}: let
version = "1.6.3"; version = "1.6.3";
srcs = { srcs = {
x86_64-linux = fetchurl { x86_64-linux = fetchurl {
url = url = "https://github.com/jstarks/npiperelay/releases/download/v0.1.0/npiperelay_windows_amd64.zip";
"https://github.com/jstarks/npiperelay/releases/download/v0.1.0/npiperelay_windows_amd64.zip";
sha256 = "sha256-a572H/0XwDUHqaPVTYFdzrPa5mmsZ/w79CJdHnZM5fY="; sha256 = "sha256-a572H/0XwDUHqaPVTYFdzrPa5mmsZ/w79CJdHnZM5fY=";
}; };
@@ -15,14 +17,14 @@ let
# sha256 = "sha256-zuy4e9bzcRqDeXP6mfzZLCDK/3we25LH6xktnO6HXps="; # sha256 = "sha256-zuy4e9bzcRqDeXP6mfzZLCDK/3we25LH6xktnO6HXps=";
# }; # };
}; };
in
in stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "npiperelay"; pname = "npiperelay";
inherit version; inherit version;
src = srcs.${stdenv.hostPlatform.system}; src = srcs.${stdenv.hostPlatform.system};
nativeBuildInputs = [ unzip ]; nativeBuildInputs = [unzip];
#buildInputs = [ qtserialport qtwebsockets ]; #buildInputs = [ qtserialport qtwebsockets ];
unpackPhase = '' unpackPhase = ''
@@ -39,14 +41,12 @@ in stdenv.mkDerivation rec {
''; '';
meta = with lib; { meta = with lib; {
description = description = "Helper to interface with Windows ssh-agent.exe service from Windows Subsystem for Linux (WSL)";
"Helper to interface with Windows ssh-agent.exe service from Windows Subsystem for Linux (WSL)";
# 2019-08-19: The homepage links to old software that doesn't even work -- # 2019-08-19: The homepage links to old software that doesn't even work --
# it fails to detect ConBee2. # it fails to detect ConBee2.
homepage = homepage = "https://github.com/rupor-github/wsl-ssh-agent";
"https://github.com/rupor-github/wsl-ssh-agent";
license = licenses.free; license = licenses.free;
platforms = [ "x86_64-linux" ]; platforms = ["x86_64-linux"];
maintainers = with maintainers; [ sstent ]; maintainers = with maintainers; [sstent];
}; };
} }

View File

@@ -1,23 +1,23 @@
{ pkgs ? import <nixpkgs> {} }: {pkgs ? import <nixpkgs> {}}:
with pkgs; let
with pkgs; nixBin = writeShellScriptBin "nix" ''
let nixBin =
writeShellScriptBin "nix" ''
${nixFlakes}/bin/nix --option experimental-features "nix-command flakes" "$@" ${nixFlakes}/bin/nix --option experimental-features "nix-command flakes" "$@"
''; '';
in mkShell { in
mkShell {
buildInputs = [ buildInputs = [
nix home-manager git ssh-to-age sops age nix
home-manager
git
ssh-to-age
sops
age
]; ];
shellHook = '' shellHook = ''
export FLAKE="$(pwd)" export FLAKE="$(pwd)"
export PATH="$FLAKE/bin:${nixBin}/bin:$PATH" export PATH="$FLAKE/bin:${nixBin}/bin:$PATH"
''; '';
} }
# { pkgs ? (import ./nixpkgs.nix) { } }: { # { pkgs ? (import ./nixpkgs.nix) { } }: {
# default = pkgs.mkShell { # default = pkgs.mkShell {
# # Enable experimental features without having to specify the argument # # Enable experimental features without having to specify the argument
@@ -25,3 +25,4 @@ in mkShell {
# nativeBuildInputs = with pkgs; [ nix home-manager git ssh-to-age sops age ]; # nativeBuildInputs = with pkgs; [ nix home-manager git ssh-to-age sops age ];
# }; # };
# } # }