2024-11-13 21:50:35 +07:00
|
|
|
# flake.nix
|
|
|
|
|
|
|
|
{
|
2024-11-13 21:56:36 +07:00
|
|
|
description = "Portable Ubuntu setup with XFCE, XRDP, Chromium, and swap";
|
2024-11-13 21:50:35 +07:00
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs";
|
|
|
|
home-manager.url = "github:nix-community/home-manager";
|
|
|
|
};
|
|
|
|
|
|
|
|
outputs = { self, nixpkgs, home-manager }:
|
|
|
|
let
|
|
|
|
system = "x86_64-linux";
|
|
|
|
pkgs = import nixpkgs { inherit system; };
|
|
|
|
in {
|
2024-11-13 21:56:36 +07:00
|
|
|
# Define the dev shell environment with XFCE, XRDP, Chromium, and utilities
|
2024-11-13 21:50:35 +07:00
|
|
|
devShell.${system} = pkgs.mkShell {
|
|
|
|
buildInputs = [
|
|
|
|
pkgs.xfce
|
|
|
|
pkgs.xfce.xfce4-terminal
|
|
|
|
pkgs.xrdp
|
2024-11-13 21:56:36 +07:00
|
|
|
pkgs.chromium # Added Chromium here
|
2024-11-13 21:50:35 +07:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
# Configuration for Home Manager, setting up XFCE and XRDP
|
|
|
|
homeConfigurations.gabriel = home-manager.lib.homeManagerConfiguration {
|
|
|
|
pkgs = import nixpkgs { inherit system; };
|
|
|
|
home.username = "gabriel";
|
|
|
|
home.homeDirectory = "/home/gabriel";
|
|
|
|
|
|
|
|
programs.bash.enable = true;
|
|
|
|
programs.xfce.enable = true;
|
|
|
|
services.xrdp.enable = true;
|
2024-11-13 21:56:36 +07:00
|
|
|
programs.chromium.enable = true; # Ensure Chromium is enabled for the user
|
2024-11-13 21:50:35 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
# System-level configuration for creating swap, user, etc.
|
|
|
|
systemConfigurations.ubuntuSetup = pkgs.lib.mkDefault {
|
|
|
|
users.users.gabriel = {
|
|
|
|
isNormalUser = true;
|
|
|
|
shell = pkgs.bashInteractive;
|
|
|
|
password = "hashedPassword"; # You can replace this with a more secure password handling mechanism
|
|
|
|
};
|
|
|
|
|
|
|
|
# Create a 2GB swap file
|
|
|
|
systemd.services.swapfile = {
|
|
|
|
enable = true;
|
|
|
|
serviceConfig.ExecStart = ''
|
|
|
|
fallocate -l 2G /swapfile
|
|
|
|
chmod 600 /swapfile
|
|
|
|
mkswap /swapfile
|
|
|
|
swapon /swapfile
|
|
|
|
'';
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
# Set up the swap entry in /etc/fstab
|
|
|
|
system.fstab = [
|
|
|
|
{
|
|
|
|
device = "/swapfile";
|
|
|
|
mountPoint = "none";
|
|
|
|
fsType = "swap";
|
|
|
|
options = "sw";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|