flake it 'til you make it

This commit is contained in:
polygon 2024-03-16 13:36:39 +00:00
parent 3113c7f66b
commit e470f49a5c
12 changed files with 121 additions and 118 deletions

63
flake.lock Normal file
View file

@ -0,0 +1,63 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1710532761,
"narHash": "sha256-SUXGZNrXX05YA9G6EmgupxhOr3swI1gcxLUeDMUhrEY=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "206f457fffdb9a73596a4cb2211a471bd305243d",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1710451336,
"narHash": "sha256-pP86Pcfu3BrAvRO7R64x7hs+GaQrjFes+mEPowCfkxY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d691274a972b3165335d261cc4671335f5c67de9",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1710420202,
"narHash": "sha256-MvFKESbq4rUWuaf2RKPNYENaSZEw/jaCLo2gU6oREcM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "878ef7d9721bee9f81f8a80819f9211ad1f993da",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-23.11",
"type": "indirect"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs",
"nixpkgs-stable": "nixpkgs-stable"
}
}
},
"root": "root",
"version": 7
}

42
flake.nix Normal file
View file

@ -0,0 +1,42 @@
{
description = "polygon's computer mess";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
nixpkgs-stable.url = "nixpkgs/nixos-23.11";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
nixpkgs-stable,
home-manager,
...
} @ inputs: let
pkgs = nixpkgs.legacyPackages."x86_64-linux";
system = "x86_64-linux";
in {
nixosConfigurations = {
twinkpad = nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs;
};
inherit system;
modules = [
./hosts/twinkpad/configuration.nix
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.polygon = import ./home-manager/desktop/home.nix;
}
];
};
};
};
}

View file

View file

@ -1,48 +0,0 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1710062421,
"narHash": "sha256-FiCNRfyUgJOLYIokLiFsfI7B+Zn9HDnOzFR3uVr5qsQ=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "36f873dfc8e2b6b89936ff3e2b74803d50447e0a",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1709961763,
"narHash": "sha256-6H95HGJHhEZtyYA3rIQpvamMKAGoa8Yh2rFV29QnuGw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "3030f185ba6a4bf4f18b87f345f104e6a6961f34",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,29 +0,0 @@
{
description = "Home Manager configuration of polygon";
inputs = {
# Specify the source of Home Manager and Nixpkgs.
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, home-manager, ... }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in {
homeConfigurations."polygon" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
# Specify your home configuration modules here, for example,
# the path to your home.nix.
modules = [ ./home.nix ];
# Optionally use extraSpecialArgs
# to pass through arguments to home.nix
};
};
}

View file

@ -13,7 +13,6 @@
# You should not change this value, even if you update Home Manager. If you do
# want to update the value, then make sure to first check the Home Manager
# release notes.
home.stateVersion = "23.11"; # Please read the comment before changing.
nixpkgs.config.allowUnfree = true;
# The home.packages option allows you to install Nix packages into your
# environment.
@ -89,9 +88,11 @@
# /etc/profiles/per-user/polygon/etc/profile.d/hm-session-vars.sh
#
home.sessionVariables = {
EDITOR = "neovim";
EDITOR = "nvim";
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
home.sessionVariables.TZ = "Europe/Berlin";
home.stateVersion = "23.11";
}

View file

@ -8,7 +8,8 @@
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./../common
./../../modules/common
./../../modules/desktop
];
# enable flakes
nix.settings.experimental-features = [ "nix-command" "flakes" ];
@ -22,7 +23,6 @@
networking.networkmanager.enable = true;
environment.pathsToLink = [ "/share/zsh" ];
environment.shells = [ "/home/polygon/.nix-profile/bin/zsh" ];
# Set your time zone.
# Enable the X11 windowing system.
services.xserver.enable = true;
@ -42,7 +42,6 @@
# Enable CUPS to print documents.
services.printing.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.polygon = {
isNormalUser = true;
@ -63,6 +62,7 @@
neovim
wget
kitty
git
];
# Some programs need SUID wrappers, can be configured further or are

View file

@ -0,0 +1,5 @@
{
imports = [
./locales.nix
];
}

View file

@ -20,5 +20,8 @@
};
time.timeZone = "Europe/Berlin";
console.keyMap = "de";
console = {
earlySetup = true;
keyMap = "de";
};
}

View file

@ -2,4 +2,4 @@
imports = [
./sound.nix
];
}
}

View file

@ -1,34 +0,0 @@
#!/bin/sh
echo "Select a machine:"
select machine in machines/*; do
if [ -n "$machine" ]; then
break
else
echo "Invalid selection."
fi
done
sudo mv /etc/nixos /etc/nixos.bak
sudo mkdir /etc/nixos
sudo ln -s "$(pwd)/$machine/*" /etc/nixos
read -p "Do you want to symlink home-manager? (y/n): " symlinkHomeManager
if [ "$symlinkHomeManager" = "y" ] || [ "$symlinkHomeManager" = "Y" ]; then
echo -e "\nSelect a home manager configuration:"
select config in home-manager/*; do
if [ -n "$config" ]; then
break
else
echo "Invalid selection."
fi
done
mv ~/.config/home-manager ~/.config/home-manager.bak
ln -s "$(pwd)/$config" ~/.config/home-manager
else
echo "Skipped symlink for home-manager"
fi
echo "Task completed successfully."