Merge pull request 'nix-rewrite-v2' (#5) from nix-rewrite-v2 into main

Reviewed-on: #5
This commit is contained in:
Joseph Hanson 2024-03-07 03:04:01 +00:00
commit 66d51db407
9 changed files with 2489 additions and 140 deletions

13
cachix/hyprland.nix Normal file
View file

@ -0,0 +1,13 @@
{
nix = {
settings = {
substituters = [
"https://hyprland.cachix.org"
];
trusted-public-keys = [
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
];
};
};
}

13
cachix/nix-community.nix Normal file
View file

@ -0,0 +1,13 @@
{
nix = {
settings = {
substituters = [
"https://nix-community.cachix.org"
];
trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
};
}

2272
flake.lock

File diff suppressed because it is too large Load diff

View file

@ -11,63 +11,87 @@
# The most widely used is `github:owner/name/reference`, # The most widely used is `github:owner/name/reference`,
# which represents the GitHub repository URL + branch/commit-id/tag. # which represents the GitHub repository URL + branch/commit-id/tag.
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
# Home Manager # Home Manager
home-manager = { home-manager-stable = {
url = "github:nix-community/home-manager/release-23.11"; url = "github:nix-community/home-manager/release-23.11";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs-stable";
};
home-manager-unstable = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs-unstable";
}; };
# nix-fast-build # nix-fast-build
nix-fast-build = { nix-fast-build = {
url = "github:Mic92/nix-fast-build"; url = "github:Mic92/nix-fast-build";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs-stable";
}; };
# sops-nix # sops-nix
sops-nix = { sops-nix = {
url = "github:Mic92/sops-nix"; url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs-stable";
}; };
# deploy-rs # deploy-rs
deploy-rs = { deploy-rs = {
url = "github:serokell/deploy-rs"; url = "github:serokell/deploy-rs";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs-stable";
}; };
# atuin # atuin
atuin = { atuin = {
url = "github:atuinsh/atuin"; url = "github:atuinsh/atuin";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs-stable";
};
# hyprland official
hyprland-git = {
url = "github:hyprwm/hyprland/v0.36.0";
};
# hyprland plugin for an i3 / sway like manual tiling layout
hy3 = {
url = "github:outfoxxed/hy3/hl0.36.0";
};
# hyprland-xdg-portal
hyprland-xdph-git = {
url = "github:hyprwm/xdg-desktop-portal-hyprland";
};
# hyprland-protocols
hyprland-protocols-git.url = "github:hyprwm/xdg-desktop-portal-hyprland";
# hyprland-community nix
hyprland-nix = {
url = "github:hyprland-community/hyprland-nix";
inputs = {
hyprland-xdph.follows = "hyprland-xdph-git";
hyprland-protocols.follows = "hyprland-protocols-git";
};
}; };
}; };
# The `@` syntax here is used to alias the attribute set of the # The `@` syntax here is used to alias the attribute set of the
# inputs's parameter, making it convenient to use inside the function. # inputs's parameter, making it convenient to use inside the function.
outputs = { self, nixpkgs, home-manager, ... }@inputs: outputs = { self, nixpkgs-stable, nixpkgs-unstable, home-manager-stable, home-manager-unstable, hy3, ... }@inputs:
let let
forAllSystems = nixpkgs.lib.genAttrs [ inherit (self) outputs;
"aarch64-linux" forAllSystems = nixpkgs-stable.lib.genAttrs [
# "aarch64-linux"
"x86_64-linux" "x86_64-linux"
]; ];
in in
{ {
hosts = import ./hosts.nix;
pkgs = forAllSystems (localSystem: import nixpkgs {
inherit localSystem;
config = {
allowUnfree = true;
allowAliases = true;
};
});
packages = forAllSystems (import ./packages inputs);
nixosConfigurations = { nixosConfigurations = {
"durincore" = nixpkgs.lib.nixosSystem { "durincore" = nixpkgs-unstable.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = inputs; specialArgs = {inherit inputs outputs;};
modules = [ modules = [
# Import the configuration.nix here, so that the # Import the configuration.nix here, so that the
# old configuration file can still take effect. # old configuration file can still take effect.
@ -75,21 +99,22 @@
./nixos/durincore/configuration.nix ./nixos/durincore/configuration.nix
./nixos/common.nix ./nixos/common.nix
# { nixpkgs.overlays = [ (self: super: { atuin = atuin.packages.${self.pkgs.system}.atuin; }) ]; } # { nixpkgs.overlays = [ (self: super: { atuin = atuin.packages.${self.pkgs.system}.atuin; }) ]; }
home-manager.nixosModules.home-manager home-manager-unstable.nixosModules.home-manager
{ {
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.users.jahanson = import ./home-manager/durincore.nix; home-manager.users.jahanson = import ./home-manager/durincore.nix;
home-manager.extraSpecialArgs = {inherit inputs outputs;};
} }
]; ];
}; };
"este" = nixpkgs.lib.nixosSystem { "este" = nixpkgs-stable.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = inputs; specialArgs = {inherit inputs outputs;};
modules = [ modules = [
./nixos/este/configuration.nix ./nixos/este/configuration.nix
./nixos/common.nix ./nixos/common.nix
home-manager.nixosModules.home-manager home-manager-stable.nixosModules.home-manager
{ {
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
@ -97,13 +122,13 @@
} }
]; ];
}; };
"gandalf" = nixpkgs.lib.nixosSystem { "gandalf" = nixpkgs-stable.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = inputs; specialArgs = {inherit inputs outputs;};
modules = [ modules = [
./nixos/gandalf/configuration.nix ./nixos/gandalf/configuration.nix
./nixos/common.nix ./nixos/common.nix
home-manager.nixosModules.home-manager home-manager-stable.nixosModules.home-manager
{ {
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
@ -112,6 +137,5 @@
]; ];
}; };
}; };
}; };
} }

View file

@ -1,16 +1,144 @@
{ config, pkgs, ... }: { config, pkgs, inputs, ... }:
{ {
# TODO please change the username & home direcotry to your own imports = [ inputs.hyprland-git.homeManagerModules.default ];
wayland.windowManager.hyprland = {
enable = true;
systemd.enable = true;
plugins = [ inputs.hy3.packages.${pkgs.system}.hy3 ];
settings = {
"monitor" = "eDP-1,1920x1080@60,0x0,1";
"$mainMod" = "SUPER";
"$terminal" = "alacritty";
"$fileManager" = "thunar";
"$menu" = "wofi --show drun";
bind =
[
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
"$mainMod, Q, exec, $terminal"
"$mainMod, C, killactive,"
"$mainMod, M, exit,"
"$mainMod, E, exec, $fileManager"
"$mainMod, V, togglefloating,"
"$mainMod, R, exec, $menu"
"$mainMod, P, pseudo, # dwindle"
"$mainMod, J, togglesplit, # dwindle"
# Move focus with mainMod + arrow keys
"$mainMod, left, movefocus, l"
"$mainMod, right, movefocus, r"
"$mainMod, up, movefocus, u"
"$mainMod, down, movefocus, d"
# Switch workspaces with mainMod + [0-9]
"$mainMod, 1, workspace, 1"
"$mainMod, 2, workspace, 2"
"$mainMod, 3, workspace, 3"
"$mainMod, 4, workspace, 4"
"$mainMod, 5, workspace, 5"
"$mainMod, 6, workspace, 6"
"$mainMod, 7, workspace, 7"
"$mainMod, 8, workspace, 8"
"$mainMod, 9, workspace, 9"
"$mainMod, 0, workspace, 10"
# Move active window to a workspace with mainMod + SHIFT + [0-9]
"$mainMod SHIFT, 1, movetoworkspace, 1"
"$mainMod SHIFT, 2, movetoworkspace, 2"
"$mainMod SHIFT, 3, movetoworkspace, 3"
"$mainMod SHIFT, 4, movetoworkspace, 4"
"$mainMod SHIFT, 5, movetoworkspace, 5"
"$mainMod SHIFT, 6, movetoworkspace, 6"
"$mainMod SHIFT, 7, movetoworkspace, 7"
"$mainMod SHIFT, 8, movetoworkspace, 8"
"$mainMod SHIFT, 9, movetoworkspace, 9"
"$mainMod SHIFT, 0, movetoworkspace, 10"
# Example special workspace (scratchpad)
"$mainMod, S, togglespecialworkspace, magic"
"$mainMod SHIFT, S, movetoworkspace, special:magic"
# Scroll through existing workspaces with mainMod + scroll
"$mainMod, mouse_down, workspace, e+1"
"$mainMod, mouse_up, workspace, e-1"
];
general = {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
gaps_in = 5;
gaps_out = 20;
border_size = 2;
"col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg";
"col.inactive_border" = "rgba(595959aa)";
layout = "dwindle";
};
decoration = {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
rounding = 10;
blur = {
enabled = true;
size = 3;
passes = 1;
vibrancy = "0.1696";
};
drop_shadow = true;
shadow_range = 4;
shadow_render_power = 3;
"col.shadow" = "rgba(1a1a1aee)";
};
animations = {
enabled = true;
# Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
bezier = "myBezier, 0.05, 0.9, 0.1, 1.05";
animation =
[
"windows, 1, 7, myBezier"
"windowsOut, 1, 7, default, popin 80%"
"border, 1, 10, default"
"borderangle, 1, 8, default"
"fade, 1, 7, default"
"workspaces, 1, 6, default"
];
};
dwindle = {
# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
pseudotile = true; # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
preserve_split = true; # you probably want this
};
master = {
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
new_is_master = true;
};
input = {
touchpad = {
natural_scroll = "true";
};
};
windowrulev2 = "suppressevent maximize, class:.*"; # You'll probably like this.
};
};
# please change the username & home direcotry to your own
home.username = "jahanson"; home.username = "jahanson";
home.homeDirectory = "/home/jahanson"; home.homeDirectory = "/home/jahanson";
# set cursor size and dpi for 4k monitor
xresources.properties = {
"Xcursor.size" = 16;
"Xft.dpi" = 172;
};
# basic configuration of git, please change to your own # basic configuration of git, please change to your own
programs.git = { programs.git = {
enable = true; enable = true;
@ -65,6 +193,11 @@
ranger ranger
yazi yazi
# gui file managers
xfce.thunar
# Run Menu
wofi
# archives # archives
zip zip
@ -195,7 +328,6 @@
env.TERM = "xterm-256color"; env.TERM = "xterm-256color";
font = { font = {
size = 12; size = 12;
draw_bold_text_with_bright_colors = true;
}; };
scrolling.multiplier = 5; scrolling.multiplier = 5;
selection.save_to_clipboard = true; selection.save_to_clipboard = true;
@ -214,7 +346,7 @@
# You can update home Manager without changing this value. See # You can update home Manager without changing this value. See
# the home Manager release notes for a list of state version # the home Manager release notes for a list of state version
# changes in each release. # changes in each release.
home.stateVersion = "23.11"; home.stateVersion = "24.05";
# 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,21 +0,0 @@
{
durincore = {
type = "nixos";
hostPlatform = "x86_64-linux";
pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBsUe5YF5z8vGcEYtQX7AAiw2rJygGf2l7xxr8nZZa7w";
};
gandalf = {
type = "nixos";
address = "gandalf.jahanson.tech";
hostPlatform = "x86_64-linux";
pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBsUe5YF5z8vGcEYtQX7AAiw2rJygGf2l7xxr8nZZa7w";
remoteBuild = true;
};
este = {
type = "nixos";
address = "este.jahanson.tech";
hostPlatform = "x86_64-linux";
pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBsUe5YF5z8vGcEYtQX7AAiw2rJygGf2l7xxr8nZZa7w";
remoteBuild = true;
};
}

View file

@ -2,7 +2,7 @@
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running 'nixos-help'). # and in the NixOS manual (accessible by running 'nixos-help').
{ config, pkgs, ... }: { config, pkgs, inputs, ... }:
{ {
imports = imports =
@ -16,23 +16,32 @@
networkmanager.enable = true; networkmanager.enable = true;
}; };
# Enable the X11 windowing system. programs.hyprland = {
services.xserver.enable = true; enable = true;
package = inputs.hyprland-git.packages.${pkgs.system}.hyprland;
# Enable the GNOME Desktop Environment.
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
services.gnome.gnome-keyring.enable = true;
security.pam.services.jahanson.enableGnomeKeyring = true;
programs.seahorse.enable = true;
# Configure keymap in X11
services.xserver = {
layout = "us";
xkbVariant = "";
}; };
environment.sessionVariables = {
NIXOS_OZONE_WL = "1";
};
# # Enable the X11 windowing system.
# services.xserver.enable = true;
# # Enable the GNOME Desktop Environment.
# services.xserver.displayManager.gdm.enable = true;
# services.xserver.desktopManager.gnome.enable = true;
# services.gnome.gnome-keyring.enable = true;
# security.pam.services.jahanson.enableGnomeKeyring = true;
# programs.seahorse.enable = true;
# # Configure keymap in X11
# services.xserver = {
# layout = "us";
# xkbVariant = "";
# };
# Enable CUPS to print documents. # Enable CUPS to print documents.
services.printing.enable = true; services.printing.enable = true;
@ -53,9 +62,6 @@
#media-session.enable = true; #media-session.enable = true;
}; };
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Some programs need SUID wrappers, can be configured further or are # Some programs need SUID wrappers, can be configured further or are
# started in user sessions. # started in user sessions.
programs.gnupg.agent = { programs.gnupg.agent = {

View file

@ -101,7 +101,7 @@
}; };
# TODO: Add xen-orchestra # Xen-orchestra
virtualisation.oci-containers = { virtualisation.oci-containers = {
backend = "podman"; backend = "podman";
containers ={ containers ={

View file

@ -1,26 +0,0 @@
{
self,
nix-fast-build,
...
}:
hostPlatform:
let
inherit (self.pkgs."x86_64-linux") callPackage lib linkFarm;
hostDrvs = lib.mapAttrs (_: nixos: nixos.config.system.build.toplevel) self.nixosConfigurations;
compatHosts = lib.filterAttrs (_: host: host.hostPlatform == hostPlatform) self.hosts;
compatHostDrvs = lib.mapAttrs
(name: _: hostDrvs.${name})
compatHosts;
compatHostsFarm = linkFarm "hosts-x86_64-linux" (lib.mapAttrsToList (name: path: { inherit name path; }) compatHostDrvs);
in
compatHostDrvs
// (lib.optionalAttrs (compatHosts != { }) {
default = compatHostsFarm;
}) // {
inherit (nix-fast-build.packages."x86_64-linux") nix-fast-build;
inherit (self.pkgs."x86_64-linux") cachix nix-eval-jobs;
}