This commit is contained in:
foglar 2025-01-12 14:25:54 +01:00
parent c3f13735c9
commit e2a893829c
3 changed files with 106 additions and 151 deletions

200
flake.nix
View File

@ -1,6 +1,109 @@
{
description = "My highly sophisticated and complicated flake";
outputs = {
self,
nixpkgs,
nixpkgs-stable,
...
} @ inputs: let
userSettings = rec {
username = "shinya"; # konsta or shinya (else defaulting to shinya or none)
hostname = "kogami"; # kogami or ginoza
shell = "zsh"; # bash, zsh
terminal = "kitty"; # kitty, alacritty, gnome-terminal
browser = "librewolf"; # firefox, librewolf, qutebrowser
editor = "neovim"; # neovim, vscode
# List all themes: $ nix build nixpkgs#base16-schemes && ls result/share/themes
theme = "catppuccin-mocha"; # catppuccin-mocha, tokyo-night-dark, one-dark
background = "aurora_borealis.png";
resolution = {
width = 1920;
height = 1080;
};
configuration_path = "/home/${username}/.dotfiles";
plasma = false;
gnome = false;
hyprland = true;
};
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
};
};
pkgs-stable = import nixpkgs-stable {
inherit system;
config = {
allowUnfree = true;
};
};
in {
# NixOS Configurations
nixosConfigurations = {
kogami = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
inherit inputs system pkgs pkgs-stable userSettings;
};
modules = [
./kogami/configuration.nix
inputs.stylix.nixosModules.stylix
inputs.nix-ld.nixosModules.nix-ld
inputs.sops-nix.nixosModules.sops
inputs.auto-cpufreq.nixosModules.default
inputs.nvf.nixosModules.default
];
};
ginoza = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
inherit inputs system pkgs pkgs-stable userSettings;
};
modules = [
./ginoza/configuration.nix
inputs.stylix.nixosModules.stylix
inputs.sops-nix.nixosModules.sops
];
};
};
# Phone Configurations
nixOnDroidConfigurations = {
tsunemori = inputs.nix-on-droid.lib.nixOnDroidConfiguration {
pkgs = import inputs.nixpkgs-droid {system = "aarch64-linux";};
modules = [
./tsunemori/configuration.nix
];
extraSpecialArgs = {
inherit inputs userSettings;
};
};
};
packages."x86_64-linux".nvf =
(inputs.nvf.lib.neovimConfiguration {
pkgs = nixpkgs.legacyPackages."x86_64-linux";
modules = [
./nixos/system/packages/nvf.nix
];
})
.neovim;
};
inputs = {
install-script = {
url = "git+https://git.foglar.tech/foglar/nix-flake-install-script";
@ -76,101 +179,4 @@
inputs.nixpkgs.follows = "nixpkgs-droid";
};
};
outputs = {
self,
nixpkgs,
nixpkgs-stable,
...
} @ inputs: let
userSettings = rec {
username = "shinya"; # konsta or shinya (else defaulting to shinya or none)
hostname = "kogami"; # kogami or ginoza
shell = "zsh"; # bash, zsh
terminal = "kitty"; # kitty, alacritty, gnome-terminal
browser = "librewolf"; # firefox, librewolf, qutebrowser
editor = "neovim"; # neovim, vscode
# List all themes: $ nix build nixpkgs#base16-schemes && ls result/share/themes
theme = "catppuccin-mocha"; # catppuccin-mocha, tokyo-night-dark, one-dark
background = "aurora_borealis.png";
configuration_path = "/home/${username}/.dotfiles";
plasma = false;
gnome = false;
hyprland = true;
};
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
};
};
pkgs-stable = import nixpkgs-stable {
inherit system;
config = {
allowUnfree = true;
};
};
in {
# NixOS Configurations
nixosConfigurations = {
kogami = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
inherit inputs system pkgs pkgs-stable userSettings;
};
modules = [
./kogami/configuration.nix
inputs.stylix.nixosModules.stylix
inputs.nix-ld.nixosModules.nix-ld
inputs.sops-nix.nixosModules.sops
inputs.auto-cpufreq.nixosModules.default
];
};
ginoza = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
inherit inputs system pkgs pkgs-stable userSettings;
};
modules = [
./ginoza/configuration.nix
inputs.stylix.nixosModules.stylix
inputs.sops-nix.nixosModules.sops
];
};
};
# Phone Configurations
nixOnDroidConfigurations = {
tsunemori = inputs.nix-on-droid.lib.nixOnDroidConfiguration {
pkgs = import inputs.nixpkgs-droid {system = "aarch64-linux";};
modules = [
./tsunemori/configuration.nix
];
extraSpecialArgs = {
inherit inputs userSettings;
};
};
};
packages."x86_64-linux".default =
(inputs.nvf.lib.neovimConfiguration {
pkgs = nixpkgs.legacyPackages."x86_64-linux";
modules = [
./nixos/system/packages/nvf.nix
];
})
.neovim;
};
}

View File

@ -1,52 +0,0 @@
#!/bin/sh
if [ $# -gt 0 ]; then
SCRIPT_DIR=$1
else
SCRIPT_DIR=~/.dotfiles
fi
if [ -d $SCRIPT_DIR ]; then
gum confirm "The directory $SCRIPT_DIR already exists. Do you want to delete it?" && yes | rm -rv $SCRIPT_DIR
fi
nixos_profile=$(gum choose kogami ginoza)
download_wallpapers=$(gum confirm "Do you want to download wallpapers (it may take longer)?" && echo true || echo false)
if [ -d $SCRIPT_DIR ]; then
gum warn "The directory $SCRIPT_DIR already exists. Downloading updates..."
cd $SCRIPT_DIR && git pull
else
nix-shell -p git --command "git clone https://git.foglar.tech/foglar/dotfiles.git $SCRIPT_DIR"
fi
sudo nixos-generate-config --show-hardware-config >$SCRIPT_DIR/kogami/hardware-configuration.nix
gum log --structured --level info "Creating hardware configuration..." file $SCRIPT_DIR/kogami/hardware-configuration.nix
sudo nixos-generate-config --show-hardware-config >$SCRIPT_DIR/ginoza/hardware-configuration.nix
gum log --structured --level info "Creating hardware configuration..." file $SCRIPT_DIR/kogami/hardware-configuration.nix
# Username
sed -i "0,/shinya/s//$(whoami)/" $SCRIPT_DIR/flake.nix
gum log --structured --level info "Setting user name in flake.nix..." file $SCRIPT_DIR/flake.nix
# Set hostname by selected profile
sed -i "0,/kogami/s//$profile/" $SCRIPT_DIR/flake.nix
gum log --structured --level info "Setting hostname in flake.nix..." file $SCRIPT_DIR/flake.nix
# Set dotfiles path as $SCRIPT_DIR path
# Editor
if [ -z $EDITOR ]; then
EDITOR=nano
fi
gum log --structured --level info "Opening flake.nix in $EDITOR..." file $SCRIPT_DIR/flake.nix
$EDITOR $SCRIPT_DIR/flake.nix
gum log --structured --level info "Building configuration for $profile..." profile $profile
sudo nixos-rebuild build --flake $SCRIPT_DIR#"${profile}"
# Wallpapers
if [ $download_wallpapers = true ]; then
gum log --structured --level info "Downloading wallpapers..." profile $profile
nix-shell -p git --command "git clone https://git.foglar.tech/foglar/wallpapers.git ~/Pictures/wallpapers"
fi
gum confirm "Do you want to reboot now?" && systemctl reboot || gum log "Please reboot later, to switch to the new configuration"

View File

@ -2,6 +2,7 @@
lib,
config,
pkgs,
userSettings,
...
}: {
options = {
@ -25,8 +26,8 @@
environment.systemPackages = with pkgs; [
(sddm-astronaut.override {
themeConfig = {
ScreenWidth = 1920;
ScreenHeight = 1080;
ScreenWidth = userSettings.resolution.width;
ScreenHeight = userSettings.resolution.height;
PartialBlur = false;
};
})