presentation-nix-flakes/prezentace.md
2025-03-13 17:40:43 +01:00

111 lines
2.3 KiB
Markdown

---
marp: true
class: invert
paginate: true
footer: "Albert Vala, Filip Kohout, Nix flakes & Nix command"
---
<style>
@import url('https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap');
:root {
background-color: rgb(10,10,10);
font-family: Ubuntu, Arial
}
h1 {
color: rgb(87, 175, 246)
}
code {
background-color: rgb(10,10,10)
}
header {
color: rgb(100,100,100)
}
footer {
color: rgb(100,100,100)
}
</style>
# Nix flakes & Nix command
---
# nix command
* Nove nix cli
---
# Proc zmena?
* Protoze treba nix-shell se nemel pouzivat na nix-shell -p
* Flake support
---
# Porovnani
```shell
nix-shell -p cowsay | nix shell nixpkgs#cowsay
```
nix eval
nix why-depends
---
# Flakes
## Why tho?
* Lockfiles.
* Flake inputs
---
# Na co flaku pouzit?
---
# Jak pouzit flakes na system configuraci?
* Flake je jen cast zbytek je v normalnich nix filech
* Zbytek konfigurace bere inputy z flaky.
* Neprijdeme o nic jen mame lock file a moznost flake jako inputu
---
# Flake example
```
{
description = "NixOS configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
zen-browser.url = "github:0xc000022070/zen-browser-flake";
};
outputs = inputs @ {
nixpkgs,
home-manager,
zen-browser,
...
}: {
nixosConfigurations = {
laptop = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./laptop/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = false;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = {inherit zen-browser;};
home-manager.users.albert = import ./modules/home.nix;
}
];
};
};
};
}
```
---
```
{
zen-browser,
config,
pkgs,
...
}: {
home.username = "nixFreak";
home.homeDirectory = "/home/nixFreak";
home.stateVersion = "24.05";
home.packages = with pkgs;
[
cowsay
]
++ [
zen-browser.packages."${system}".default
];
programs.home-manager.enable = true;
}
```
---