This commit is contained in:
cy 2024-12-13 11:28:27 -05:00
parent f5bc46061b
commit 7ca1fb1b89
5 changed files with 136 additions and 137 deletions

View file

@ -19,51 +19,50 @@
nixpkgs, nixpkgs,
home-manager, home-manager,
... ...
}@inputs: let } @ inputs: let
lib = nixpkgs.lib; lib = nixpkgs.lib;
inherit (self) outputs; inherit (self) outputs;
systems = [ "x86_64-linux" ]; systems = ["x86_64-linux"];
forEachSystem = f: lib.genAttrs systems (system: f pkgsFor.${system}); forEachSystem = f: lib.genAttrs systems (system: f pkgsFor.${system});
pkgsFor = lib.genAttrs systems ( pkgsFor = lib.genAttrs systems (
system: system:
import nixpkgs { import nixpkgs {
inherit system; inherit system;
config.allowUnfree = true; config.allowUnfree = true;
}
);
in {
packages = forEachSystem (pkgs: import ./pkgs {inherit pkgs;});
formatter = forEachSystem (pkgs: pkgs.alejandra);
devShells = forEachSystem (pkgs: import ./shells {inherit pkgs;});
nixosModules = import ./modules/nixos;
homeManagerModules = import ./modules/home-manager;
overlays = import ./overlays {inherit inputs outputs;};
nixosConfigurations = let
pkgs = pkgsFor.x86_64-linux;
in {
ytnix = lib.nixosSystem {
specialArgs = {inherit inputs outputs;};
modules = [
{
nixpkgs = {inherit pkgs;};
} }
); ./hosts/ytnix
in inputs.sops-nix.nixosModules.sops
{ ];
packages = forEachSystem (pkgs: import ./pkgs { inherit pkgs; });
formatter = forEachSystem (pkgs: pkgs.alejandra);
devShells = forEachSystem (pkgs: import ./shells { inherit pkgs; });
nixosModules = import ./modules/nixos;
homeManagerModules = import ./modules/home-manager;
overlays = import ./overlays {inherit inputs outputs;};
nixosConfigurations = let
pkgs = pkgsFor.x86_64-linux;
in {
ytnix = lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
modules = [
{
nixpkgs = {inherit pkgs;};
}
./hosts/ytnix
inputs.sops-nix.nixosModules.sops
];
};
};
homeConfigurations = {
"yt@ytnix" = home-manager.lib.homeManagerConfiguration {
pkgs = pkgsFor.x86_64-linux;
extraSpecialArgs = { inherit inputs outputs; };
modules = [
./home/yt/ytnix.nix
];
};
}; };
}; };
homeConfigurations = {
"yt@ytnix" = home-manager.lib.homeManagerConfiguration {
pkgs = pkgsFor.x86_64-linux;
extraSpecialArgs = {inherit inputs outputs;};
modules = [
./home/yt/ytnix.nix
];
};
};
};
} }

View file

@ -19,7 +19,7 @@
channel.enable = false; channel.enable = false;
optimise = { optimise = {
automatic = true; automatic = true;
dates = [ "03:45" ]; dates = ["03:45"];
}; };
gc = { gc = {
automatic = true; automatic = true;
@ -33,9 +33,9 @@
sops.defaultSopsFormat = "yaml"; sops.defaultSopsFormat = "yaml";
sops.age.keyFile = "/root/.config/sops/age/keys.txt"; sops.age.keyFile = "/root/.config/sops/age/keys.txt";
sops.secrets = { sops.secrets = {
"borg/yt" = { }; "borg/yt" = {};
"azure" = { }; "azure" = {};
"ntfy" = { }; "ntfy" = {};
}; };
boot = { boot = {
@ -68,10 +68,10 @@
dns = "none"; dns = "none";
wifi.backend = "iwd"; wifi.backend = "iwd";
}; };
nameservers = [ "127.0.0.1" "::1" ]; nameservers = ["127.0.0.1" "::1"];
resolvconf.enable = true; resolvconf.enable = true;
firewall = { firewall = {
trustedInterfaces = [ "wgnord" ]; trustedInterfaces = ["wgnord"];
}; };
}; };
programs.nm-applet.enable = true; programs.nm-applet.enable = true;
@ -91,7 +91,7 @@
"bluez5.enable-sbc-xq" = true; "bluez5.enable-sbc-xq" = true;
"bluez5.enable-msbc" = true; "bluez5.enable-msbc" = true;
"bluez5.enable-hw-volume" = true; "bluez5.enable-hw-volume" = true;
"bluez5.roles" = [ "a2dp_sink" "a2dp_source" ]; "bluez5.roles" = ["a2dp_sink" "a2dp_source"];
}; };
}; };
}; };
@ -100,7 +100,7 @@
users.users.yt = { users.users.yt = {
isNormalUser = true; isNormalUser = true;
extraGroups = [ "wheel" "libvirtd" "docker" ]; extraGroups = ["wheel" "libvirtd" "docker"];
shell = pkgs.zsh; shell = pkgs.zsh;
}; };
@ -167,7 +167,7 @@
programs.sway.enable = true; programs.sway.enable = true;
services.borgbackup.jobs.ytnixRsync = { services.borgbackup.jobs.ytnixRsync = {
paths = [ "/root" "/home" "/var/lib" "/var/log" "/opt" "/etc" ]; paths = ["/root" "/home" "/var/lib" "/var/log" "/opt" "/etc"];
exclude = [ exclude = [
"**/.cache" "**/.cache"
"**/node_modules" "**/node_modules"
@ -192,7 +192,7 @@
}; };
compression = "auto,zstd"; compression = "auto,zstd";
startAt = "daily"; startAt = "daily";
extraCreateArgs = [ "--stats" ]; extraCreateArgs = ["--stats"];
# warnings are often not that serious # warnings are often not that serious
failOnWarnings = false; failOnWarnings = false;
postHook = '' postHook = ''
@ -209,8 +209,8 @@
snapshot_preserve_min = "2d"; snapshot_preserve_min = "2d";
snapshot_dir = "/snapshots"; snapshot_dir = "/snapshots";
subvolume = { subvolume = {
"/home" = { }; "/home" = {};
"/" = { }; "/" = {};
}; };
}; };
}; };

View file

@ -1,57 +1,58 @@
# Do not modify this file! It was generated by ‘nixos-generate-config’ # Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ {
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" ]; config,
boot.initrd.kernelModules = [ ]; lib,
boot.kernelModules = [ "kvm-intel" ]; pkgs,
boot.extraModulePackages = [ ]; modulesPath,
...
}: {
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod"];
boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = [];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/17870658-6118-46af-837f-70c9175e09c3";
device = "/dev/disk/by-uuid/17870658-6118-46af-837f-70c9175e09c3"; fsType = "btrfs";
fsType = "btrfs"; options = ["subvol=root" "compress=zstd"];
options = [ "subvol=root" "compress=zstd" ]; };
};
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/c6098a16-c8a6-4a97-8648-6f46ca919d13"; boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/c6098a16-c8a6-4a97-8648-6f46ca919d13";
fileSystems."/home" = fileSystems."/home" = {
{ device = "/dev/disk/by-uuid/17870658-6118-46af-837f-70c9175e09c3";
device = "/dev/disk/by-uuid/17870658-6118-46af-837f-70c9175e09c3"; fsType = "btrfs";
fsType = "btrfs"; options = ["subvol=home" "compress=zstd"];
options = [ "subvol=home" "compress=zstd" ]; };
};
fileSystems."/nix" = fileSystems."/nix" = {
{ device = "/dev/disk/by-uuid/17870658-6118-46af-837f-70c9175e09c3";
device = "/dev/disk/by-uuid/17870658-6118-46af-837f-70c9175e09c3"; fsType = "btrfs";
fsType = "btrfs"; options = ["subvol=nix" "compress=zstd" "noatime"];
options = [ "subvol=nix" "compress=zstd" "noatime" ]; };
};
fileSystems."/swap" = fileSystems."/swap" = {
{ device = "/dev/disk/by-uuid/17870658-6118-46af-837f-70c9175e09c3";
device = "/dev/disk/by-uuid/17870658-6118-46af-837f-70c9175e09c3"; fsType = "btrfs";
fsType = "btrfs"; options = ["subvol=swap"];
options = [ "subvol=swap" ]; };
};
fileSystems."/boot" = fileSystems."/boot" = {
{ device = "/dev/disk/by-uuid/29B7-F46D";
device = "/dev/disk/by-uuid/29B7-F46D"; fsType = "vfat";
fsType = "vfat"; options = ["fmask=0022" "dmask=0022"];
options = [ "fmask=0022" "dmask=0022" ]; };
};
swapDevices = [{ swapDevices = [
device = "/swap/swapfile"; {
}]; device = "/swap/swapfile";
}
];
boot.resumeDevice = "/dev/disk/by-uuid/17870658-6118-46af-837f-70c9175e09c3"; boot.resumeDevice = "/dev/disk/by-uuid/17870658-6118-46af-837f-70c9175e09c3";
boot.kernelParams = [ "resume_offset=53224704" ]; boot.kernelParams = ["resume_offset=53224704"];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's

View file

@ -1,18 +1,16 @@
{ fetchurl {
, stdenv fetchurl,
, lib stdenv,
, buildFHSEnv lib,
, appimageTools buildFHSEnv,
, writeShellScript appimageTools,
, anki writeShellScript,
, undmg anki,
, zstd undmg,
, cacert zstd,
, commandLineArgs ? [ ] cacert,
, commandLineArgs ? [],
}: }: let
let
pname = "anki-bin"; pname = "anki-bin";
# Update hashes for both Linux and Darwin! # Update hashes for both Linux and Darwin!
version = "24.11"; version = "24.11";
@ -37,7 +35,7 @@ let
unpacked = stdenv.mkDerivation { unpacked = stdenv.mkDerivation {
inherit pname version; inherit pname version;
nativeBuildInputs = [ zstd ]; nativeBuildInputs = [zstd];
src = sources.linux; src = sources.linux;
installPhase = '' installPhase = ''
@ -55,7 +53,8 @@ let
}; };
meta = with lib; { meta = with lib; {
inherit (anki.meta) inherit
(anki.meta)
license license
homepage homepage
description description
@ -67,7 +66,7 @@ let
"x86_64-darwin" "x86_64-darwin"
"aarch64-darwin" "aarch64-darwin"
]; ];
maintainers = with maintainers; [ mahmoudk1000 ]; maintainers = with maintainers; [mahmoudk1000];
}; };
passthru = { passthru = {
@ -87,14 +86,12 @@ let
''; '';
# Dependencies of anki # Dependencies of anki
targetPkgs = targetPkgs = pkgs: (with pkgs; [
pkgs: xorg.libxkbfile
(with pkgs; [ xcb-util-cursor-HEAD
xorg.libxkbfile krb5
xcb-util-cursor-HEAD zstd
krb5 ]);
zstd
]);
runScript = writeShellScript "anki-wrapper.sh" '' runScript = writeShellScript "anki-wrapper.sh" ''
exec ${unpacked}/bin/anki ${lib.strings.escapeShellArgs commandLineArgs} "$@" exec ${unpacked}/bin/anki ${lib.strings.escapeShellArgs commandLineArgs} "$@"
@ -114,22 +111,24 @@ let
} }
); );
in in
if stdenv.hostPlatform.isLinux
then fhsEnvAnki
else
stdenv.mkDerivation {
inherit pname version passthru;
if stdenv.hostPlatform.isLinux then src =
fhsEnvAnki if stdenv.hostPlatform.isAarch64
else then sources.darwin-aarch64
stdenv.mkDerivation { else sources.darwin-x86_64;
inherit pname version passthru;
src = if stdenv.hostPlatform.isAarch64 then sources.darwin-aarch64 else sources.darwin-x86_64; nativeBuildInputs = [undmg];
sourceRoot = ".";
nativeBuildInputs = [ undmg ]; installPhase = ''
sourceRoot = "."; mkdir -p $out/Applications/
cp -a Anki.app $out/Applications/
'';
installPhase = '' inherit meta;
mkdir -p $out/Applications/ }
cp -a Anki.app $out/Applications/
'';
inherit meta;
}

View file

@ -1,3 +1,3 @@
pkgs: { pkgs: {
anki-bin = pkgs.callPackage ./anki-bin.nix { }; anki-bin = pkgs.callPackage ./anki-bin.nix {};
} }