Initial setup

This commit is contained in:
outfoxxed 2023-06-19 21:08:11 -07:00
commit 9b4ec6e0a1
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
5 changed files with 241 additions and 0 deletions

63
flake.lock Normal file
View file

@ -0,0 +1,63 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1687204608,
"narHash": "sha256-rZ0e0iAIQM7vlsMd2/pcGfymZzNBRawObFgqIpxE94c=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "f06a43dca05fb7f1aa44742bf861d9c827b45122",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1686960236,
"narHash": "sha256-AYCC9rXNLpUWzD9hm+askOfpliLEC9kwAo7ITJc4HIw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "04af42f3b31dba0ef742d254456dc4c14eedac86",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs",
"stable": "stable"
}
},
"stable": {
"locked": {
"lastModified": 1687093939,
"narHash": "sha256-zw9ztAI3G7ayjRFK9G18yiy4NceLZMF6QKWZC+eyWs0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "572d26930456132e7f2035340e3d88b36a5e9b6e",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-23.05",
"type": "indirect"
}
}
},
"root": "root",
"version": 7
}

26
flake.nix Normal file
View file

@ -0,0 +1,26 @@
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
stable.url = "nixpkgs/nixos-23.05";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ { self, nixpkgs, ... }: {
nixosConfigurations = {
lenovo = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
specialArgs = { inherit system inputs; };
modules = [
./systems/lenovo.nix
./modules/core.nix
./modules/user
];
};
};
};
}

67
modules/core.nix Normal file
View file

@ -0,0 +1,67 @@
{ inputs, pkgs, ... }: {
boot.loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
nixpkgs.config.allowUnfree = true;
nix = {
# hardlink duplicate files in the nix store
settings.auto-optimise-store = true;
extraOptions = ''
experimental-features = nix-command flakes
# keep intermediary deps alive (no redownloading to rebuild after gc)
keep-outputs = true
keep-derivations = true
'';
# flake registries are used by the new nix commands.
# this binds the nixpkgs registry to the one in `flake.nix`.
registry = {
nixpkgs.flake = inputs.nixpkgs;
};
# the nix path is used to discover channels for the old nix commands.
# this binds the nix path to the channels following `flake.nix` declared below.
nixPath = [
"nixpkgs=/etc/nix/inputs/nixpkgs"
];
};
# add entries for `nixPath` above.
environment.etc = {
"nix/inputs/nixpkgs".source = inputs.nixpkgs.outPath;
};
# allow processes to request scheduling priority
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
networking = {
networkmanager = {
enable = true;
dns = "systemd-resolved";
};
nameservers = [ "9.9.9.9" ];
};
services.resolved = {
enable = true;
dnssec = "true";
fallbackDns = [ "9.9.9.9" ];
extraConfig = ''
DNSOverTLS=yes
'';
};
}

68
modules/user/default.nix Normal file
View file

@ -0,0 +1,68 @@
{ system, inputs, config, pkgs, ... }: let
username = "admin";
homeDirectory = "/home/${username}";
in {
imports = [ inputs.home-manager.nixosModules.home-manager ];
users.users.${username} = {
isNormalUser = true;
uid = 1000;
extraGroups = [ "wheel" ];
initialPassword = "test";
};
fonts = {
enableDefaultFonts = false;
fonts = with inputs.stable.legacyPackages.${system}; [
dejavu_fonts
nerdfonts
noto-fonts
noto-fonts-cjk
];
};
systemd = {
# kde polkit agent
user.services.polkit-agent = {
wants = [ "graphical-session.target" ];
after = [ "graphical-session.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1";
Restart = "on-failure";
RestartSec = 1;
TimeoutStopSec = 10;
};
};
};
programs.gnupg.agent = {
enable = true;
pinentryFlavor = "gnome3";
};
environment.variables = {
XCURSOR_SIZE = "24";
};
programs.hyprland.enable = true;
home-manager = {
extraSpecialArgs = {
inherit system inputs;
systemConfig = config;
};
# use system nixpkgs instead of home-manager nixpkgs
useGlobalPkgs = true;
users.${username} = { system, inputs, systemConfig, pkgs, ... }: {
home = {
inherit username homeDirectory;
stateVersion = systemConfig.system.stateVersion;
};
};
};
}

17
systems/lenovo.nix Normal file
View file

@ -0,0 +1,17 @@
{ pkgs, ... }: {
system.stateVersion = "23.11";
networking.hostName = "lenovo";
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
extraPackages = with pkgs; [
rocm-opencl-icd
amdvlk
];
extraPackages32 = with pkgs; [
driversi686Linux.amdvlk
];
};
}