Skip to content

Instantly share code, notes, and snippets.

@r-vdp

r-vdp/flake.nix Secret

Last active June 25, 2023 22:04
Show Gist options
  • Save r-vdp/7da32fb0ae0f9ddb6b8f5b199d1996a7 to your computer and use it in GitHub Desktop.
Save r-vdp/7da32fb0ae0f9ddb6b8f5b199d1996a7 to your computer and use it in GitHub Desktop.
pcloud workaround with flakes
{
description = "dotfiles";
inputs = {
nixpkgs.url = "nixpkgs/nixos-23.05";
nixpkgs_22_11.url = "github:nixos/nixpkgs/nixos-22.11";
home-manager.url = "github:nix-community/home-manager/release-23.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, nixpkgs_22_11, home-manager, ... }:
let
system = "x86_64-linux";
pkgs = nixpkgs {
inherit system;
config = { allowUnfree = true; };
};
pkgs_22_11 = import nixpkgs_22_11 {
inherit system;
config.allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) (map lib.getName [
pkgs_22_11.pcloud
]);
};
lib = nixpkgs.lib;
mkSystem = pkgs: system: hostname:
lib.nixosSystem {
inherit system;
modules = [
{ networking.hostName = hostname; }
{ system.stateVersion = "23.05"; }
(./. + "/hosts/${hostname}/configuration.nix")
({ pkgs, ... }: {
environment.systemPackages = [
self.packages.${pkgs.stdenv.system}.pcloud
];
})
home-manager.nixosModules.home-manager
{
home-manager = {
useUserPackages = false;
useGlobalPkgs = true;
users.leier = {
imports = [ (./. + "/hosts/${hostname}/home") ];
home.stateVersion = "23.05";
};
};
}
];
};
in {
nixosConfigurations = {
desktop = mkSystem nixpkgs system "desktop";
};
packages.${system}.pcloud = pkgs_22_11.pcloud.overrideAttrs (prev:
let
version = "1.13.0";
code = "XZecm6VZIz4VKYBrUbzzhcfNW9boSfrfhgaV";
# Archive link's codes: https://www.pcloud.com/release-notes/linux.html
src = pkgs.fetchzip {
url = "https://api.pcloud.com/getpubzip?code=${code}&filename=${prev.pname}-${version}.zip";
hash = "sha256-eJpwoVCI96Yow7WfVs3rRwC4D1kh7x7HuMFU7YEFHCM=";
};
appimageContents = pkgs.appimageTools.extractType2 {
name = "${prev.pname}-${version}";
src = "${src}/pcloud";
};
in
{
inherit version;
src = appimageContents;
});
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment