1
Fork 0

Tried setting up a vm machine

This commit is contained in:
Matei Adriel 2023-05-28 05:24:36 +02:00
parent 230a739327
commit dda932b1b0
No known key found for this signature in database
23 changed files with 104 additions and 66 deletions

View file

@ -1,27 +1,43 @@
# Welcome to *the Satellite*
# Welcome to _the Satellite_
In case you are not familiar with nix/nixos, this is a collection of configuration files which build my entire system in a declarative manner. The tool used to configure the global system is called [nixos](https://nixos.org/), and the one used to configure the individual users is called [home-manager](https://github.com/nix-community/home-manager).
In case you are not familiar with nix/nixos, this is a collection of configuration files which build my entire system in a declarative manner. The tool used to configure the global system is called [nixos](https://nixos.org/), and the one used to configure the individual users is called [home-manager](https://github.com/nix-community/home-manager).
### Features this repository includes:
- Consistent base16 theming using [stylix](https://github.com/danth/stylix)
- [Agenix](https://github.com/ryantm/agenix) & [homeage](https://github.com/jordanisaacs/homeage) based secret management
- Sets up all the apps I use — including git, neovim, fish, tmux, starship, xmonad, rofi, polybar, discord, zathura, alacritty & more.
- [Agenix](https://github.com/ryantm/agenix) & [homeage](https://github.com/jordanisaacs/homeage) based secret management
- Sets up all the apps I use — including git, neovim, fish, tmux, starship, xmonad, rofi, polybar, discord, zathura, alacritty & more.
### In the future I might start using any of the other cool nix-based tools, like:
- [nix-darwin](https://github.com/LnL7/nix-darwin) - like nixos but for macs
- [disko](https://github.com/nix-community/disko) - format disks using nix
- [impernanence](https://github.com/nix-community/impermanence) - see the article about [erasing your darlings](https://grahamc.com/blog/erase-your-darlings)
The current state of this repo is a refactor of my old, messy nixos config, based on the structure of [this template](https://github.com/Misterio77/nix-starter-configs).
### Hosts
This repo's structure is based on the concept of hosts - individual machines configured by me. I'm naming each host based on things in space/mythology (*they are the same picture*). The hosts I have right now are:
This repo's structure is based on the concept of hosts - individual machines configured by me. I'm naming each host based on things in space/mythology (_they are the same picture_). The hosts I have right now are:
- [tethys](./hosts/nixos) - my personal laptop
### File structure
| Location | Description |
| ---------------------------- | ------------------------------------------------------------------ |
| [common](./common) | Configuration loaded on both nixos and home-manager |
| [dotfiles](./dotfiles) | Contains some of the bigger dotfile dirs. Will eventually be moved |
| [hosts/nixos](./hosts/nixos) | Nixos configurations |
| [home](./home) | Home manager configurations |
| [pkgs](./pkgs) | Nix packages |
| [overlays](./overlays) | Nix overlays |
| [devshells](./devshells) | Nix shells |
| [stylua.toml](./stylua.toml) | Lua formatter config for the repo |
| [flake.nix](./flake.nix) | Nix flake entrypoint! |
| [shell.nix](./shell.nix) | Bootstrapping nix shell |
| [nixpkgs.nix](./nixpkgs.nix) | Pinned nixpkgs for bootstrapping |
| [secrets.nix](./secrets.nix) | Agenix entrypoint |
### Points of interest
Here's some things you might want to check out:
@ -33,22 +49,27 @@ Here's some things you might want to check out:
> Well, this does not include links to every plugin I used for every program here, you can see more details in the respective configurations
- [nixos](http://nixos.org/) - nix based operating system
- [home-manager](https://github.com/nix-community/home-manager) - manage user configuration using nix
- [stylix](https://github.com/danth/stylix) - base16 module for nix
- [Base16 templates](https://github.com/chriskempson/base16-templates-source) - list of base16 theme templates
- [Catpuccin](https://github.com/catppuccin/catppuccin) - base16 theme I use
- [Rosepine](https://rosepinetheme.com/) - another theme I use
- [Nixos](http://nixos.org/) - nix based operating system
- [Home-manager](https://github.com/nix-community/home-manager) - manage user configuration using nix
- [Impernanence](https://github.com/nix-community/impermanence) - see the article about [erasing your darlings](https://grahamc.com/blog/erase-your-darlings)
- [Stylix](https://github.com/danth/stylix) - base16 module for nix
- [Base16 templates](https://github.com/chriskempson/base16-templates-source) - list of base16 theme templates
- [Catpuccin](https://github.com/catppuccin/catppuccin) - base16 theme I use
- [Rosepine](https://rosepinetheme.com/) - another theme I use
- [Agenix](https://github.com/ryantm/agenix) & [homeage](https://github.com/jordanisaacs/homeage) - secret management
- [Xmonad](https://xmonad.org/) - window manager
- [Polybar](https://github.com/polybar/polybar) - desktop bar
- [Rofi](https://github.com/davatorium/rofi) - program launcher
- [Xmonad](https://xmonad.org/) - xorg window manager
- [Polybar](https://github.com/polybar/polybar) - desktop bar
- [Rofi](https://github.com/davatorium/rofi) - program launcher
- [Hyprland](https://hyprland.org/) - wayland compositor
- [Wlogout](https://github.com/ArtsyMacaw/wlogout) - wayland logout menu
- [Wofi](https://sr.ht/~scoopta/wofi/) - program launcher
- [Neovim](https://neovim.io/) - my editor
- [Neovide](https://neovide.dev/index.html) - neovim gui client
- [Vimclip](https://github.com/hrantzsch/vimclip) - vim anywhere!
- [Firenvim](https://github.com/glacambre/firenvim) - embed neovim in web browsers
- [Tmux](https://github.com/tmux/tmux/wiki) - terminal multiplexer
- [Alacritty](https://github.com/alacritty/alacritty) - terminal emulator
- [Wezterm](https://wezfurlong.org/wezterm/) - terminal emulator
- [Fish](https://fishshell.com/) - user friendly shell
- [Starship](https://starship.rs/) - shell prompt
- [Zathura](https://pwmt.org/projects/zathura/) - pdf viewer

View file

@ -1,10 +0,0 @@
{
stylix = {
# image = ./wallpapers/eye.png;
image = ./wallpapers/colorful1.png;
# image = ./wallpapers/colorful2.png;
# image = ./wallpapers/colorful3.jpg;
polarity = "light";
};
}

View file

@ -2,7 +2,6 @@
# Select your current theme here!
imports = [
./rose-pine-dawn.nix
# ./ai.nix
];
# Requires me to manually turn targets on!

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 MiB

View file

@ -118,13 +118,13 @@
# Available through 'nixos-rebuild --flake .#...
nixosConfigurations =
let
nixos = { system, hostname }: nixpkgs.lib.nixosSystem {
nixos = { system, hostname, user }: nixpkgs.lib.nixosSystem {
specialArgs = specialArgs system;
modules = [
home-manager.nixosModules.home-manager
{
home-manager.users.adrielus = import ./home/tethys.nix;
home-manager.users.${user} = import ./home/${hostname}.nix;
home-manager.extraSpecialArgs = specialArgs system;
home-manager.useUserPackages = true;
stylix.homeManagerIntegration.followSystem = false;
@ -139,10 +139,13 @@
tethys = nixos {
system = "x86_64-linux";
hostname = "tethys";
user = "adrielus";
};
euporie = nixos {
system = "x86_64-linux";
hostname = "euporie";
user = "guest";
};
};
# }}}

View file

@ -2,6 +2,7 @@
if status is-interactive
and not set -q TMUX
and not set -q NO_TMUX
and set -q ALWAYS_TMUX
exec tmux attach -t Welcome || tmux || echo "Something went wrong trying to start tmux"
end
# }}}

View file

@ -12,7 +12,11 @@
y = 4;
};
env = { TERM = "tmux-256color"; };
env = {
TERM = "tmux-256color";
ALWAYS_TMUX = 1;
};
working_directory = "${config.home.homeDirectory}/Projects/";
};
};

View file

@ -4,7 +4,7 @@ let
template = builtins.readFile ./template.yuck;
};
widgets = config.satellite.dev.path "home/adrielus/features/desktop/common/eww/widgets";
widgets = config.satellite.dev.path "home/features/desktop/eww/widgets";
in
{
home.packages = [ pkgs.eww ];

View file

@ -4,5 +4,5 @@
# Create link to config
xdg.configFile."wezterm/colorscheme.lua".text = config.satellite.colorscheme.lua;
xdg.configFile."wezterm/wezterm.lua".source =
config.satellite.dev.path "home/adrielus/features/desktop/common/wezterm/wezterm.lua";
config.satellite.dev.path "home/features/desktop/wezterm/wezterm.lua";
}

View file

@ -10,7 +10,7 @@ let
../features/cli
../features/neovim
../../../common
../../common
];
# }}}
# {{{ Overlays

View file

@ -35,5 +35,4 @@ in
allowUnfree = true;
};
};
}

View file

@ -54,7 +54,7 @@ in
}))
# attrsetof { ... } -> attrsetof { ... }
(lib.attrset.filterAttrs
(lib.attrsets.filterAttrs
# string -> { ... } -> bool
(_: { publicKeyFile, ... }: builtins.pathExists publicKeyFile))
];

View file

@ -2,6 +2,7 @@
let greeter = "enso";
in
{
services.xserver.enable = true;
services.xserver.displayManager.lightdm = {
enable = true;
@ -17,6 +18,9 @@ in
};
};
# Set default display manager
services.xserver.displayManager.defaultSession = lib.mkDefault "hyprland";
stylix.targets.lightdm.enable = true;
}

View file

@ -1,4 +1,4 @@
{ pkgs, config, ... }:
{ pkgs, config, lib, ... }:
{
services.xserver = {
enable = true;
@ -15,14 +15,6 @@
# Proper wallpaper zooming
desktopManager.wallpaper.mode = "fill";
# Make xmonad session the default
displayManager.defaultSession = "none+xmonad";
};
# Enable ad-hoc stylix targets:
stylix.targets = {
gtk.enable = true;
};
}

View file

@ -1,11 +1,4 @@
{ pkgs, outputs, config, lib, ... }:
let
# Record containing all the hosts
hosts = outputs.nixosConfigurations;
# Function from hostname to relative path to public ssh key
idKey = host: ../../${host}/id_ed25519.pub;
in
{
# Password file stored through agenix
age.secrets.adrielusPassword.file = ./adrielus_password.age;
@ -35,17 +28,7 @@ in
];
openssh.authorizedKeys.keyFiles =
lib.pipe hosts [
# attrsetof host -> attrsetof path
(builtins.mapAttrs
(name: _: idKey name)) # string -> host -> path
# attrsetof path -> path[]
builtins.attrValues
# path[] -> path[]
(builtins.filter builtins.pathExists)
];
(import ./common.nix).authorizedKeys { inherit outputs lib; };
};
};
}

View file

@ -0,0 +1,21 @@
{
authorizedKeys = { outputs, lib }:
let
# Record containing all the hosts
hosts = outputs.nixosConfigurations;
# Function from hostname to relative path to public ssh key
idKey = host: ../../${host}/id_ed25519.pub;
in
lib.pipe hosts [
# attrsetof host -> attrsetof path
(builtins.mapAttrs
(name: _: idKey name)) # string -> host -> path
# attrsetof path -> path[]
builtins.attrValues
# path[] -> path[]
(builtins.filter builtins.pathExists)
];
}

View file

@ -0,0 +1,13 @@
# For more comments check out [adrielus](./adrielus.nix)
{ pkgs, outputs, lib, ... }:
{
users.mutableUsers = false;
users.users.guest = {
isNormalUser = true;
shell = pkgs.fish;
extraGroups = [ "wheel" "audio" "video" "network" "tty" ];
password = "heyo";
openssh.authorizedKeys.keyFiles =
(import ./common.nix).authorizedKeys { inherit outputs lib; };
};
}

View file

@ -1,6 +1,7 @@
{
{ lib, ... }: {
imports = [
../common/global
../common/users/guest.nix
../common/optional/pipewire.nix
../common/optional/touchpad.nix
@ -9,6 +10,9 @@
../common/optional/hyprland.nix
];
# Usually included in the hardware-configuration
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
# Set the name of this machine!
networking.hostName = "euporie";

View file

@ -25,10 +25,14 @@
# {{{ A few ad-hoc hardware settings
hardware.opengl.enable = true;
hardware.opentabletdrivers.enable = true;
hardware.opentabletdriver.enable = true;
# }}}
# {{{ A few ad-hoc programs
programs.kdeconnect.enable = true;
programs.extra-container.enable = true;
# }}}
# {{{ Ad-hoc stylix targets
# TODO: include this on all gui hosts
stylix.targets.gtk.enable = true;
# }}}
}

View file

@ -11,6 +11,8 @@ in
};
app = lib.mkOption {
default = { };
description = "Attr set of firefox web apps to install as desktop apps";
type = lib.types.attrsOf
(lib.types.submodule ({ name, ... }: {
options = {
@ -50,8 +52,6 @@ in
};
};
}));
description = "Attr set of firefox web apps to install as desktop apps";
};
};

View file

@ -8,5 +8,5 @@ in
"./hosts/nixos/common/users/adrielus_password.age".publicKeys = [ adrielus tethys ];
# Scoped for the user
"./home/adrielus/features/desktop/common/wakatime/wakatime_config.age".publicKeys = [ adrielus ];
"./home/features/desktop/wakatime/wakatime_config.age".publicKeys = [ adrielus ];
}